0
我在Windows Server 2008 R2上设置了Apache2并加载了PHP模块。我想执行下面的PHP脚本:Apache/PHP - curl模块没有正确执行
$ch = curl_init('https://itunes.apple.com/us/rss/toppaidapplications/genre=36/limit=15/json');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_NOSIGNAL, 1);
curl_setopt($ch, CURLOPT_TIMEOUT_MS, 200000);
$string = curl_exec($ch);
curl_close($ch);
$arr = json_decode($string,true);
foreach($arr['feed']['entry'] as $val)
{
$var = $val['link']['0']['attributes']['href'];
echo $var;
}
我得到的,当我与我的CMS(镆铘)加载此错误消息
Warning: Invalid argument supplied for foreach() in C:\webserver\www\site1\core\cache\includes\elements\modsnippet\4.include.cache.php on line 15
我想我已经配置了一些错误无论是在Apache:httpd的.conf或在php.ini中,因为在另一个未由我设置的网络服务器上,脚本运行良好。
的phpinfo告诉我,卷曲启用(PHP版本5.4.17)
curl
cURL support enabled
cURL Information 7.30.0
Age 3
Features
AsynchDNS Yes
Debug No
GSS-Negotiate Yes
IDN No
IPv6 Yes
Largefile Yes
NTLM Yes
SPNEGO Yes
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/0.9.8y
ZLib Version 1.2.7
libSSH Version libssh2/1.4.2
在哪里运行脚本时我运行一个旧版本的PHP(PHP版本5.2.17)的网络服务器。这里的phpinfo赛斯:
curl
cURL support enabled
cURL Information libcurl/7.24.0 OpenSSL/1.0.0i zlib/1.2.5
在我的php.ini是writen以下指着php_curl.dll
extension="c:\webserver\php\ext\php_curl.dll"