Using analog landing to crawl the school system's morning run data, failed, ask the great God

Source: Internet
Author: User
Use analog landing to crawl the school system's morning run data, failed, ask the great God
Recently in the study of PHP simulation landing, I want to take the school's physical education system practice, but failed. Ask the great God, what is wrong with my code?

"Some Information"
Address of the login system: http://210.35.75.247:8080/student/studentFrame.jsp
(Username: 1101001, Password: 1101001, role: Student)
Check the morning run address: http://210.35.75.247:8080/student/queryCheckInfo.jsp

"Code as follows"
 
  $cookie _file = Tempnam ('./temp ', ' Cookie ');
$login _url = ' http://210.35.75.247:8080/student/studentFrame.jsp ';
$post _fields = ' username=1101001&passwd=1101001 ';

$ch = Curl_init ($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, $cookie _file);
Curl_exec ($ch);
Curl_close ($ch);

$url = ' http://210.35.75.247:8080/student/queryCheckInfo.jsp ';
$ch = Curl_init ($url);
curl_setopt ($ch, Curlopt_header, 0);
curl_setopt ($ch, Curlopt_returntransfer, 0);
curl_setopt ($ch, Curlopt_cookiefile, $cookie _file);
Curl_exec ($ch);
Curl_close ($ch);
?>


"The first time post, humbly!" 】
------Solution--------------------
I'm just a rookie, studying and studying together.
First declare a few nouns ...
Frame page student/studentframe.jsp The action address of the form submission
Student Information page student/studentinfo.jsp is the framework page of the IFRAME automatically loaded SRC
Morning Run score student/querycheckinfo.jsp
With Firebug tracking the landing process, found that the framework page IFRAME loading student information with parameters? username=...&passwd= ..., guess the real landing process should be on the Student Information page. I have failed to log on the page echo saved in the file, the framework page HTML and landing success is almost the same, just a bit more jump JS. The use of the Student Information page of the Jsessionid landed successfully, and the frame page contrast, not the same. Egg-ache Management system



$url 1 = ' http://210.35.75.247:8080/student/studentInfo.jsp ';
$url 2 = ' http://210.35.75.247:8080/student/queryCheckInfo.jsp ';
$name = ' 1101001 ';
$PW = ' 1101001 ';
$params = Array (
' UserName ' = $name,
' passwd ' = $PW,
);

$ch = Curl_init ();
curl_setopt ($ch, Curlopt_url, $url 1. '?' . Http_build_query ($params));
curl_setopt ($ch, Curlopt_header, 1);
curl_setopt ($ch, Curlopt_returntransfer, 1);
$con = curl_exec ($ch);

Preg_match ('/set-cookie: (. *);/us ', $con, $match);
$cookie = $match [1];

curl_setopt ($ch, Curlopt_url, $url 2);
curl_setopt ($ch, Curlopt_header, 0);
curl_setopt ($ch, Curlopt_cookie, $cookie);
$con = curl_exec ($ch);
Curl_close ($ch);

Echo $con;

  • 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.