PHP Curl Simulation Login problem for help, welcome to the onlookers, even if not the answer will certainly have a harvest
$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);
This is a code fragment in a class that simulates a login, but discovers a problem, that is, if the submitted password begins with @, the Curlopt_postfields part considers that a file was submitted, which causes the login to fail. How to solve this problem?
Curl's description in http://cn2.php.net/curl_setopt
If you don't answer, it's okay, think about getting an inspiration from here? To prevent your Web site from being crawled by curl, you can find a way to get a list of required items that begin with @, so my demo login will fail ...
Who's going to answer that? Thank you
------Solution--------------------
This post was last edited by xuzuning on 2013-01-25 09:26:17
History will explain everything.
Php-curl package [Avoid uploading files ambiguity bug]
------Solution--------------------
Try this class with httpclient.class.php.