I am trying to send a cURL request but it is not working at all, I am using PHP 5.4 version because of code legacy. cURL extension is installed and working. I have tried by var_dump(extension_loaded('curl')); and this returns true. also, I have used headers
I am trying to send a single parameter clientid which has value in variable $client_id
header('Access-Control-Allow-Origin: *');
header('Content-type: application/json');
In update.php
print_r($_POST);
var_dump ($_POST);
This below code is not working –
$ch =curl_init('https://beta.mymains.in/service/update.php');
$data = array('clientid' => $client_id);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);
And I tried this code, and this works I mean this is hitting the url?
$ch = curl_init("http://www.google.com/");
$fp = fopen("google_homepage.txt", "w");
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);
fclose($fp);
curl_exec($ch);
curl_close($ch);