cURL + json_decode PHP Issue

Hi Team,

I am trying to compile my application which gets some information from HTTP/GET Request. The compilation is working great except for the cURL + json_decode operation which is simply not working.

Already tested all PHP versions and included curl and openssl DLL’s.

Running below code works perfectly well.

Any assistance will be higly appreciated!

Code below:

$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => ‘http://server_ip/esc.php’,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => ‘’,
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => ‘GET’,
));

$fieldinfo = curl_exec($curl);
$fieldinfo = json_decode($fieldinfo, true);
curl_close($curl);

hi. i also same problem before and i solved. you can check this post

gdgsoft.info/t/curl-not-response/5783

Hi @kakkuk, thanks for the reply!

I am using a HTTP connection, however I gave a try. Ufortunately, same issue :frowning:

Thanks anyway!

No curl guru but if you post the exact error messages you are getting it may help discover your issue. ‘simply not working’ tells us nothing:) I assume you have the CURL extension active and also use the openssl for good measures :wink:

I always start by getting my project CURL working on a server. Once I have it ironed out, I move to exeout.

Hi @oldteacher, thanks a lot for your reply :slight_smile:

Yes, as mentioned, the code is working perfectly fine being executed as php.

You are right, I have not posted much details. When executing the compiled .exe just not getting any output on the $fieldinfo variable.

Do you believe I can add something else / try something else?

Glad to provide any input I can, got a lot of input from others here and like to return it.

Without your code that works on localhost / or server, impossible for anyone to help you.

For example: I go the doctor and tell her my body hurts, but I cannot tell her which part:)

Thanks again for the followup.

The code is posted on my first post. Then, I get 3 values and print them. That’s all.

You have to modify your PHP code so that you use curl_error in order to get the reason why your code fails.
Learn more here: PHP: curl_error - Manual