私はcurlを使用してapiにアクセスしようとしましたが、https以外のサイトで出力されましたが、https認証サイトでこのコードを更新しますが動作しません。以下のようにhttps以外のサイトで作業しているようなコードを試しました。 httpsサイトでhttp apiを呼び出すためにcurlを使用
$url = "http://45.116.113.98:8081/WebAP1/api/SchemeMast/1/40/WEBDTG100-/45/-/Prabakaran/S/-/4-44,pillaiyar%20kovil%20street,ko.thoppu%20vill,nochalu/-/Villupuram/Villupuram/Tamil%20Nadu/India/604201/9787162221/9787162221/0.000/100.00/2017-12-21/C";
$headers = array();
$headers[] = 'Accept: image/gif, image/x-bitmap, image/jpeg, image/pjpeg';
$headers[] = 'Connection: Keep-Alive';
$headers[] = 'Content-type: application/x-www-form-urlencoded;charset=UTF-8';
$user_agent = 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; Media Center PC 4.0)';
$process = curl_init($url);
curl_setopt($process, CURLOPT_HTTPHEADER, $headers);
curl_setopt($process, CURLOPT_HEADER, 0);
curl_setopt($process, CURLOPT_USERAGENT, $user_agent);
curl_setopt($process, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($process, CURLOPT_FOLLOWLOCATION, 1);
$return = curl_exec($process);
curl_close($process);
もまた、このようにしてみました
、 curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
curl_setopt($ch, CURLOPT_HTTPGET, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION , 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
しかし、両方とも私のHTTPSサイトで作業されていない
[PHP CURL&HTTPS](https://stackoverflow.com/questions/4372710/php-curl-https)の可能な複製 – IcedAnt
'curl_setopt($ ch、CURLOPT_SSL_VERIFYPEER、FALSE);これだけで十分ですしかし、私はあなたのURLにアクセスしようとしましたが、動作していません。あなたのカールスクリプトは良いようです。 –
しかし私のhttpsサイトで働いていない、同じことが私のhttpサイトで働いています –