Php卷曲输出空白在我的情况下

时间:2014-11-23 12:45:09

标签: php curl

<?php


// 1. initialize
$ch = curl_init();

// 2. set the options, including the url
curl_setopt($ch, CURLOPT_URL, "https://somesite.edu");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, 0);

// 3. execute and fetch the resulting HTML output
$output = curl_exec($ch);

echo $output;

// 4. free up the curl handle
curl_close($ch);

?>

我使用npm curl并且确实检索了一些内容但是当我在php中尝试时它返回空白。我的问题是什么?我已经说过CURLOPT_RETURNTRANSFER为真。

1 个答案:

答案 0 :(得分:1)

尝试在你的卷曲上添加另一个选项:

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);