CURL setopt无法正常工作

use*_*318 3 php ssh curl

可能重复:
mysql_fetch_array()期望参数1是资源,在select中给出boolean

我正在开发一个导入MLS列表数据的PHP脚本.当我通过CLI执行脚本时,我收到以下错误:

PHP警告:curl_setopt()期望参数1是资源,字符串283中的/var/www/clients/client4/web4/web/wp-content/plugins/import-rets/RETS_class.php中给出的字符串PHP警告:curl_exec( )期望参数1是资源,字符串284中的/var/www/clients/client4/web4/web/wp-content/plugins/import-rets/RETS_class.php中给出的字符串PHP警告:curl_error()期望参数1到是资源,第287行/var/www/clients/client4/web4/web/wp-content/plugins/import-rets/RETS_class.php中给出的字符串PHP警告:curl_getinfo()期望参数1为资源,给定字符串在/var/www/clients/client4/web4/web/wp-content/plugins/import-rets/RETS_class.php第295行PHP警告:curl_close()期望参数1是资源,字符串在/ var/www中给出第191行上的/clients/client4/web4/web/wp-content/plugins/import-rets/RETS_class.php PHP警告:curl_setopt()期望参数2为long,在/ var/www/clients/client4 /中给出数组WEB4 /网络/可湿性粉剂内容/插件/进口可再生能源技术/ RETS_clas 第283行的s.php PHP警告:curl_setopt()期望参数2为long,在/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;
Run Code Online (Sandbox Code Playgroud)

任何支持将不胜感激.

ila*_*nco 7

你设置$this->ch了卷曲实例吗?

$this->ch = curl_init();

你可能打算使用curl_setopt_array而不是curl_setopt.