1

The content will not load from the file, here is my curl code,

curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
// GET CONTENTS OF HASHES.TXT
curl_setopt($curl, CURLOPT_URL, 'http://xxx.com/api/x.txt');
// SUCCESSFULY OPENED HASHES.TXT
$file = curl_exec($curl);
echo $file; // RETURNS NOTHING
echo curl_error($curl); // COULDN'T CONNECT TO HOST
echo curl_getinfo($curl, CURLINFO_HTTP_CODE); // 0

The curl is working as I have previously opened other webpages further up the script,

Thanks

4

1 に答える 1

1

変数への応答を取得するには、次を使用する必要があります。

curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); 

実行する前に。

于 2012-05-22T17:48:02.620 に答える