$post_fields['zjh']=$this->username;
$post_fields['mm']=$this->password;
$ch = curl_init($this->login_url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);
curl_setopt($ch, CURLOPT_COOKIEJAR, $this->cookie_file);
$str=curl_exec($ch);
curl_close($ch);
这是一个类中的代码片断,作用是模拟登录,但发现一个问题,[email protected],那CURLOPT_POSTFIELDS部分就认为提交了一个文件,这样导致登录失败。如何解决这个问题?
CURL的说明在 http://cn2.php.net/curl_setopt
如果你不会解答,没关系,想一想从这里是不是得到了一个启发?为了防止自己的网站被CURL登录抓取,[email protected],这样我这种模拟登录就失效了。。。
谁会解答啊。。谢谢
------解决方案--------------------
历史会说明一切
php-curl封装[避免上传文件二义性Bug]
------解决方案--------------------
用httpclient.class.php这个类,试试