Curl Analog Login Always pop-up verification code is incorrect

Source: Internet
Author: User
Tags send cookies
Header ("content-type:text/html; charset=gb2312 ");
$CookieFile =tempnam ("./tmep", "Beast");
if (Isset ($_get["img"])) {
$url = ' http://jwc.wyu.edu.cn/student/rndnum.asp ';//Verification Code code
$ch = Curl_init ($url);
curl_setopt ($ch, Curlopt_cookiejar, $CookieFile);//Save the returned cookie information in a file
Curl_exec ($ch);
Curl_close ($ch);
Exit ();
}
if (Isset ($_post[' d ')) {
$b =$_post[' d '];//verification code
$p = "usercode=3114002555&userpwd= Don't tell You &validate=". $b. " &submit= Submit ";
$ch = Curl_init ();
2. Setting options, including URLs
$reffer = ' http://jwc.wyu.edu.cn/student/body.htm ';
curl_setopt ($ch, Curlopt_referer, $reffer);
curl_setopt ($ch, Curlopt_useragent, "mozilla/5.0 (Windows NT 6.3; WOW64; rv:39.0) gecko/20100101 firefox/39.0 ");
curl_setopt ($ch, Curlopt_url, "http://jwc.wyu.edu.cn/student/logon.asp");
curl_setopt ($ch, Curlopt_cookiejar, $CookieFile);
curl_setopt ($ch, Curlopt_cookiefile, $CookieFile);//Send cookies at the same time
curl_setopt ($ch, Curlopt_returntransfer, 1);
curl_setopt ($ch, Curlopt_post, 1);
curl_setopt ($ch, Curlopt_postfields, $p);//Submit Query Information
$s = curl_exec ($ch);
Curl_close ($ch);
$ch = Curl_init ();
$reffer = ' http://jwc.wyu.edu.cn/student/body.htm ';
curl_setopt ($ch, Curlopt_referer, $reffer);
curl_setopt ($ch, Curlopt_useragent, "mozilla/5.0 (Windows NT 6.3; WOW64; rv:39.0) gecko/20100101 firefox/39.0 ");
curl_setopt ($ch, Curlopt_url, "http://jwc.wyu.edu.cn/student/logon.asp");
curl_setopt ($ch, curlopt_followlocation,true);
curl_setopt ($ch, Curlopt_cookiefile, $CookieFile);//Send cookies at the same time
curl_setopt ($ch, Curlopt_cookiejar, $CookieFile);
curl_setopt ($ch, Curlopt_returntransfer, 1);
curl_setopt ($ch, Curlopt_post, 1);
curl_setopt ($ch, Curlopt_postfields, $p);//Submit Query Information
$bs = curl_exec ($ch);
echo $bs;//output result
Curl_close ($ch);
}else{
?>

}
?>


Reply to discussion (solution)

$url = ' http://jwc.wyu.edu.cn/student/';p rint_r (get_headers ($url));
Array
(
[0] = = http/1.1-OK
[1] = Cache-control:private
[2] = Connection:close
[3] = Date:mon, 11:30:29 GMT
[4] = content-length:617
[5] = content-type:text/html
[6] = = SET-COOKIE:ASPSESSIONIDCQAATSAR=HGOCKONAKIMOPBIOFJFHPGFI; path=/
[7] = Server:iis
[8] = x-powered-by:waf/2.0
[9] = = set-cookie:safedog-flow-item=6bfdb3bc0a21c98b7224b81c2c04c934; Expires=mon, 24-aug-2015 16:00:29 GMT; domain=wyu.edu.cn; path=/
)
Access to the homepage there is already a session, you read the verification code is not carried on is not possible

How to take the session, where to take

$url = ' http://jwc.wyu.edu.cn/student/';p rint_r (get_headers ($url));
Array
(
[0] = = http/1.1-OK
[1] = Cache-control:private
[2] = Connection:close
[3] = Date:mon, 11:30:29 GMT
[4] = content-length:617
[5] = content-type:text/html
[6] = = SET-COOKIE:ASPSESSIONIDCQAATSAR=HGOCKONAKIMOPBIOFJFHPGFI; path=/
[7] = Server:iis
[8] = x-powered-by:waf/2.0
[9] = = set-cookie:safedog-flow-item=6bfdb3bc0a21c98b7224b81c2c04c934; Expires=mon, 24-aug-2015 16:00:29 GMT; domain=wyu.edu.cn; path=/
)
Access to the homepage there is already a session, you read the verification code is not carried on is not possible



How long did it take me to learn, curl, if you could just tell me?

$url = ' http://jwc.wyu.edu.cn/student/';p rint_r (get_headers ($url));
Array
(
[0] = = http/1.1-OK
[1] = Cache-control:private
[2] = Connection:close
[3] = Date:mon, 11:30:29 GMT
[4] = content-length:617
[5] = content-type:text/html
[6] = = SET-COOKIE:ASPSESSIONIDCQAATSAR=HGOCKONAKIMOPBIOFJFHPGFI; path=/
[7] = Server:iis
[8] = x-powered-by:waf/2.0
[9] = = set-cookie:safedog-flow-item=6bfdb3bc0a21c98b7224b81c2c04c934; Expires=mon, 24-aug-2015 16:00:29 GMT; domain=wyu.edu.cn; path=/
)
Access to the homepage there is already a session, you read the verification code is not carried on is not possible



can be used curl_setopt ($ch, Curlopt_httpheader, "SET-COOKIE:ASPSESSIONIDCQAATSAR=HGOCKONAKIMOPBIOFJFHPGFI; path=/");

$url = ' http://jwc.wyu.edu.cn/student/';p rint_r (get_headers ($url));
Array
(
[0] = = http/1.1-OK
[1] = Cache-control:private
[2] = Connection:close
[3] = Date:mon, 11:30:29 GMT
[4] = content-length:617
[5] = content-type:text/html
[6] = = SET-COOKIE:ASPSESSIONIDCQAATSAR=HGOCKONAKIMOPBIOFJFHPGFI; path=/
[7] = Server:iis
[8] = x-powered-by:waf/2.0
[9] = = set-cookie:safedog-flow-item=6bfdb3bc0a21c98b7224b81c2c04c934; Expires=mon, 24-aug-2015 16:00:29 GMT; domain=wyu.edu.cn; path=/
)
Access to the homepage there is already a session, you read the verification code is not carried on is not possible


Thank you very much for simulating my landing.
  • 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.