<?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捲曲,它確實檢索了一些東西,但是當我嘗試在PHP中它返回空白。我的問題是什麼?我已經說CURLOPT_RETURNTRANSFER爲true。在我的情況下,PHP捲曲輸出空白
我測試你的腳本,它給我返回的內容。另外SSL驗證似乎不成問題。也許你被禁止或服務器期望更多的標題(例如接受,useragent) – 2014-11-23 13:32:00