<?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를 true로 말했습니다.PHP 컬 결과가 내 케이스에 비어 있습니다.
나는 스크립트를 테스트하고 나를 위해 내용을 반환합니다. 또한 SSL 확인이 문제가되지 않습니다. 아마도 당신은 금지되었거나 서버가 더 많은 헤더 (예 : accept, useragent)를 기대하고 있습니다. –