如何在https网站中使用curl

时间:2019-06-30 09:15:10

标签: php curl

我将以下代码用于php程序,但它工作不很多。 请帮我 谢谢

 <?php
 $base = "https://www.sanarate.ir/default.aspx";
 $curl = curl_init();
 curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
 curl_setopt($curl, CURLOPT_HEADER, false);
 curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
 curl_setopt($curl, CURLOPT_URL, $base);
 curl_setopt($curl, CURLOPT_REFERER, $base);
 curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
 curl_setopt($curl, CURLOPT_USERAGENT, "spider");
 $str = curl_exec($curl);
 print_r($str);
 curl_close($curl);

0 个答案:

没有答案