Bonjour
j'utilise ça pour me connecter à un site :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
char * pFile;
DWORD dwFileSize = 0, dwByteRead = 0;
DWORD dwContext = 0;
char szURL[] = "http://.....";
HINTERNET hSession, hUrl;
hSession = InternetOpen("test", INTERNET_OPEN_TYPE_DIRECT, 0, 0, 0);
if(hSession == NULL) {MessageBox (hDlg, "Erreur de connexion Internet ...." , "Erreur", NULL); return 0;}
hUrl = InternetOpenUrl(hSession, szURL, 0, 0, INTERNET_FLAG_EXISTING_CONNECT, (DWORD_PTR)&dwContext); if(hUrl == NULL) {MessageBox (hDlg, "Erreur de connexion internet !" , "Erreur", NULL); return 0;}
if(!InternetQueryDataAvailable(hUrl, &dwFileSize, 0, (DWORD_PTR)&dwContext)){MessageBox (hDlg, "Erreur de connexion internet" , "Erreur", NULL);}
pFile = (char*)malloc(dwFileSize+1);
memset(pFile, 0, dwFileSize);
if(!InternetReadFile(hUrl, pFile, dwFileSize, &dwByteRead)){MessageBox (hDlg, "Erreur de connexion internet" , "Erreur", NULL);}
pFile[dwByteRead] = 0;
InternetCloseHandle(hUrl);
InternetCloseHandle(hSession);
ofstream log("protsock.log");
     log << pFile;
     SetDlgItemText(hDlg, 155, pFile); 
     free(pFile);
Pour l'envoye de donné vers une base mysql je pense inclure une page php qui va faire le travail. la methode la plus simple, serai de passer par GET (essai.php?heuredevol=10 ....) mais bon pas tres sur, je me demande alors si il y aurais un moyen de d'envoyer les donnees en mode POST
Merci de vos reponce