Something is wrong with my curl script

I use a CURL script to basically recreate the process when the user has to click submit on the form. I would like everything to work in the background, but it never gets sent when this script is executed.

$ch = curl_init();
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
    "&shopId=".$ID."&encodedMessage=".urlencode($encodedMessage)."&signature=".$signature);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_USERAGENT, 
    "Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.3) Gecko/20041001 Firefox/0.10.1" );
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);

$result = curl_exec($ch); 

Perhaps this is not fulfilled?

+3
source share
2 answers

Tested, works great.

Did you set the variable correctly $url?

+1
source

Curl is not a good option for emulating a fork.

Once your current script stops, the curl request will be killed and the destination URL will probably also stop executing its own script.

cron , . .

0

All Articles