起因:
公司购买的shopex程序取得商业授权认证失败,对方程序员弄了个测试代码来表明是由于我对服务器的设置有问题导致的。
原代码:
$fp = fsockopen(http://www.shopex.cn/, 80, $errno, $errstr, 30);
错误提示:
$fp = fsockopen("http://www.shopex.cn/", 80, $errno, $errstr, 30);
Warning: fsockopen() [function.fsockopen]: unable to connect to http://www.shopex.cn/:80 (Unable to find the socket transport "http" – did you forget to enable
it when you configured PHP?) in D:\xampp\htdocs\mediashop_cn\test.php on
line 2
Unable to find the socket transport "http" – did you forget to enable it when you configured PHP? (24)
解决:
1.修改代码为:
$fp = fsockopen("www.shopex.cn", 80, $errno, $errstr, 30);
或
$fp = fsockopen("tcp://www.shopex.cn", 80, $errno, $errstr, 30);
参考:
http://uk.php.net/manual/en/function.fsockopen.php
http://uk.php.net/manual/en/transports.php
2.设置服务器防火墙允许服务器访问外部网站,至少允许访问www.shopex.cn
留下你的看法: