We are executing a curl function using php. curl execution was working properly and getting the result, but we have to do the following step every morning:
We need to open the particular URL in browser first.
Is there anything we need to do in curl/php script to avoid the above step? Is this related a security issue or something?
below is my code:
$curl = curl_init();
curl_setopt($curl,CURLOPT_HTTPHEADER,array ("Content-Type:application/x-www-form-urlencoded"));
curl_setopt($curl, CURLOPT_POST, 1); // Do a regular HTTP POST
curl_setopt($curl, CURLOPT_POSTFIELDS, 'client_id=' . urlencode($client_id) . '&' .
'client_secret=' . urlencode($client_secret) . '&' .
'grant_type=client_credentials' . '&' .
'scope=openid');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_FAILONERROR, FALSE);
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_URL, $token_url);
$response = curl_exec($curl);