Witajcie. Pragnę przesłać wartość zmiennych z mojej aplikacji:
oldV1 = readString(processHandle, var1_value); // odczytanie danych z pamieci procesu
oldV2 = readString(processHandle, var2_value);
do skryptu php. Korzystam więc z takiego kodu:
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl)
{
/* First set the URL that is about to receive our POST. This URL can
just as well be a https:// URL if that is what should receive the
data. */
curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1/proj/index.php");
/* Now specify the POST data */
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "var1=tutajchcedanezezmiennej&var2=tutaksamo");
/* Perform the request, res will get the return code */
res = curl_easy_perform(curl);
/* always cleanup */
curl_easy_cleanup(curl);
}
Próbowałem zrobić tak:
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl)
{
/* First set the URL that is about to receive our POST. This URL can
just as well be a https:// URL if that is what should receive the
data. */
curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1/proj/index.php");
/* Now specify the POST data */
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "var1="+oldV1+"&var2="+oldV2+"");
/* Perform the request, res will get the return code */
res = curl_easy_perform(curl);
/* always cleanup */
curl_easy_cleanup(curl);
}
jednak to nie działa. Moje pytanie: jak za pomocą tego kodu mogę przesłać te zmienne do skryptu php? Z góry dziękuję za pomoc.