可能重复:
mysql_fetch_array() expects parameter 1 to be resource, boolean given in select
$url = $this->getAppParam('sandbox') ? 'www.sandbox.paypal.com' : 'www.paypal.com';
// OCT 31,2011 : now paypal uses ssl:// in url and port 443
$fp = fsockopen ('ssl://'.$url , 443, $errno, $errstr, 30);
XiError::assert($fp);
// post data back to PayPal system to validate
$header = "POST /cgi-bin/webscr HTTP/1.0\r\n";
$header .= "Host: $url\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
fputs ($fp, $header . $req);
// read the response data now
$return = false;
while( ! feof($fp)){
//XITODO : Add this to tmp log file
$response = fgets ($fp, 1024); //echo $res;
if (strcmp ($response, 'VERIFIED') == 0) {
$return = true;
}
if (strcmp ($response, 'INVALID') == 0) {
$return = false;
}
}
XiError ::断言
static function assert($condition, $msg = '', $type = self::ERROR)
{
// assert only if in debug mode
if($condition || !(JDEBUG)){
return true;
}
//raise error
if($type == self::ERROR){
self::raiseError('XI-ERROR', $msg);
}
//raise warning
if($type == self::WARNING){
self::raiseWarning('XI-WARNING', $msg);
}
// enqueue message
XiFactory::getApplication()->enqueueMessage('XI-WARNING : '.$msg);
}
这是我正在使用的代码。它正在产生警告
PHP Warning: fgets() expects parameter 1 to be resource, boolean given in /var/www/****
一秒钟50次。
这导致我的服务器出现4 GB错误日志。有什么想法吗?
答案 0 :(得分:0)
不要使用套接字!在php.Curl中使用 CURL 是套接字无效时php的最佳选择。