PHP Curl Simulation Login related issues, welcome to onlookers, even if not the answer will certainly have a harvest

Source: Internet
Author: User
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.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.