2012-05-09 103 views
3

Possible Duplicate:
mysql_fetch_array() expects parameter 1 to be resource, boolean given in select捲曲SETOPT無法正常工作

我的工作是進口MLS掛牌數據的PHP腳本。當我通過CLI執行腳本時,出現以下錯誤:

PHP警告:curl_setopt()期望參數1是/ var/www/clients/client4/web4/web/wp-content /插件/ import-rets/RETS_class.php在線283 PHP警告:curl_exec()期望參數1是資源,字符串在/ var/www/clients/client4/web4/web/wp-content/plugins/PHP警告:curl_error()需要參數1爲資源,字符串在/ var/www/clients/client4/web4/web/wp-content/plugins/import-rets/RETS_class中給出。 PHP在線287 PHP警告:curl_getinfo()期望參數1是資源,字符串在/var/www/clients/client4/web4/web/wp-content/plugins/import-rets/RETS_class.php在295行中給出 PHP Wa rning:curl_close()期望參數1是資源,字符串在/var/www/clients/client4/web4/web/wp-content/plugins/import-rets/RETS_class.php在線191 PHP Warning:curl_setopt( )期望參數2很長,數組在/var/www/clients/client4/web4/web/wp-content/plugins/import-rets/RETS_class.php在線283 PHP警告:curl_setopt()期望參數2長,數組中/var/www/clients/client4/web4/web/wp-content/plugins/import-rets/RETS_class.php給出線283

這裏是我的代碼:

if (!$this->user_agent_auth) { 
$options[CURLOPT_HTTPAUTH] = CURLAUTH_DIGEST|CURLAUTH_BASIC; 
$options[CURLOPT_USERPWD] = $this->account.":".$this->password; 
} elseif ($this->exec_count <> 1) { 
$options[CURLOPT_HTTPAUTH] = CURLAUTH_DIGEST; 
$options[CURLOPT_USERPWD] = $this->account.":".$this->password; 
} 
curl_setopt($this->ch, $options, $value); 
$response = curl_exec($this->ch); 


$error = curl_error($this->ch); 
if ($error != '') { 
$this->response['curl_error'] = $error; 
$this->response['request_header'] =''; 
$this->response['received_header']=''; 
$this->response['received_body'] =''; 
$this->response['http_code']  =''; 
} else { 
$this->response = curl_getinfo($this->ch); 
$this->response['curl_error'] = ''; 
$this->response['received_header'] = substr($response, 0, $this->response['header_size']); 
$this->response['received_body'] = substr($response, $this->response['header_size']); 
} 
$this->response['data'] = $data; 

任何支持,將不勝感激。

+1

可以粘貼var_dump($ this-> ch)的輸出 – Scuzzy

+0

在單獨的文件中還是同一個文件中? – user1249318

回答

7

您是否將$this->ch設置爲捲曲實例?

$this->ch = curl_init();

而且你可能是指使用curl_setopt_array而不是curl_setopt。

+0

錯誤我得到PHP警告:curl_setopt_array()期望完全2個參數,3在/var/www/clients/client4/web4/web/wp-content/plugins/import-rets/RETS_class.php在線283 – user1249318

+0

閱讀[該功能](http://php.net/manual/en/function.curl-setopt-array.php)的文檔,它只需要兩個參數。 – Scuzzy

+0

這是,嘗試複製其中一個例子,並根據您的需要對其進行自定義 – ilanco