このURIで試すまで、cURLで成功した外部ドメインからいくつかのデータをインポートしています:http ://www.airbnb.com/calendar/ical/760186.ics?s = 29623a93eb0e693c77591a711f082f06 、これはicsカレンダーです。コマンドラインで正常に実行できます(自分で試してみてください):shell >> curl https://www.airbnb.com/calendar/ical/760660.ics?s=593cc556438a8f0919beb6107b6f508d、ネットワークの問題ではありません。
しかし、私のphpスクリプト(他のURIを返します)はこれを返しません。またはそれ以上の場合はfalseを返します。
これが小さなphpです
function file_get_contents_curl($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
$ical1= "http://www.airbnb.com/calendar/ical/760186.ics?s=29623a93eb0e693c77591a711f082f06";
echo file_get_contents_curl($ical1);
これは、appfogで実行され、古いxamppインストールで実行されるため、apacheまたはphpの構成と関係があると思います。再開するには:すべてのURIは古いxamppインストールで機能し、現在は例の1つだけが失敗します。
私のphpinfo()で私は読むことができます:
cURL support enabled
cURL Information 7.24.0
Age 3
Features
AsynchDNS Yes
Debug No
GSS-Negotiate Yes
IDN No
IPv6 Yes
Largefile Yes
NTLM Yes
SPNEGO No
SSL Yes
SSPI Yes
krb4 No
libz Yes
CharConv No
Protocols dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, pop3, pop3s, rtsp, scp, sftp, smtp, smtps, telnet, tftp
Host i386-pc-win32
SSL Version OpenSSL/1.0.1c
ZLib Version 1.2.5
libSSH Version libssh2/1.3.0