<?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为真。
答案 0 :(得分:1)
尝试在你的卷曲上添加另一个选项:
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);