Ask a curl data collection question
Modern teaching management system of colleges and universities
Related connections:Student status information query system
This is the html code of the logon interface.
Header ("content-Type: text/html; charset = utf-8 ");
Require_once 'search. php ';
// Step 1: submit data, generate a cookie, and save the cookie in the temporary directory
$ Cookiejar = realpath ('cookie.txt ');
$ Id = $ _ GET ['id'];
$ Password = $ _ GET ['password'];
$ Year = $ _ GET ['Year'];
$ Term = $ _ GET ['term '];
$ Ch = curl_init ();
$ Login_url = "http: // 211.67.32.51 /";
$ CurlPost = "_ VIEWSTATE = signature % 2BO2w8bzxmPjs % 2BPjs7Pjs % signature % 2BOz4% 2 BOzs % 2BOz4% signature % 2 FCbCuTw % 3D & tbYHM = k061138526 & tbPSW = 100311 & ddlSF = students & imgDL. x = 0 & imgDL. y = 0 ";
Curl_setopt ($ ch, CURLOPT_URL, $ login_url );
// When enabled, the header file information is output as a data stream.
Curl_setopt ($ ch, CURLOPT_HEADER, 0 );
Curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 1 );
Curl_setopt ($ ch, CURLOPT_REFERER, 'http: // 211.67.32.51 /');
Curl_setopt ($ ch, CURLOPT_POST, 1 );
Curl_setopt ($ ch, CURLOPT_POSTFIELDS, $ curlPost );
// Sets the file for storing cookie information after the connection ends.
Curl_setopt ($ ch, CURLOPT_COOKIEJAR, $ cookiejar );
$ Data = curl_exec ($ ch );
$ Data = mb_convert_encoding ($ data, "UTF-8", "gb2312 ");
Echo $ data;
// Echo' '. Search3 ($ id, $ year, $ term, $ ch ).' ';
?>
This is my php file for simulating server login.
This is the post data and header information captured by firebug. The problem is that every time this file is executed, "select a role" is returned ", the ddlSF attribute above gives a value. what is the problem?
Reply to discussion (solution)
Your php uses UTF-8, but firebug shows gb2312. (we recommend that you use gbk instead of gb2312 in the program)
Confirm which one is correct
Is it correct? I changed it or it's useless.
Is it correct? I changed it or it's useless.
I don't know where you came from ......
Zend studio encoding
You cannot understand the operations of these editors.
The key is that the code "ddlSF = student" must be the same as the code of the website of the other party. Otherwise, the other party will not recognize the code when it is submitted.
I coded him. if it was you, which function would you use to encode it for her?
I coded him. if it was you, which function would you use to encode it for her?
Where? No
$ CurlPost = "_ VIEWSTATE = signature % 2BO2w8bzxmPjs % 2BPjs7Pjs % signature % 2BOz4% 2 BOzs % 2BOz4% signature % 2 FCbCuTw % 3D & tbYHM = k061138526 & tbPSW = 100311 & ddlSF = students & imgDL. x = 0 & imgDL. y = 0 "; $ curlPost = iconv (" UTF-8 "," GBK ", $ curlPost );
After I submit the value of _ VIEWSTATE, the system returns the Object moved to here ...... can you give me some experience?
Here, gbk
Header ("content-Type: text/html; charset = utf-8 ");
Here, UTF-8 is used to unify the two.
$ CurlPost = "_ VIEWSTATE = signature % 2BO2w8bzxmPjs % 2BPjs7Pjs % signature % 2BOz4% 2 BOzs % 2BOz4% signature % 2 FCbCuTw % 3D & tbYHM = k061138526 & tbPSW = 100311 & ddlSF = students & imgDL. x = 0 & imgDL. y = 0 "; $ curlPost = iconv (" UTF-8 "," GBK ", $ curlPost );
Hello, my current source code is like this. Header ("content-Type: text/html; charset = utf-8 ");
Require_once 'search. php ';
// Step 1: submit data, generate a cookie, and save the cookie in the temporary directory
$ Cookiejar = realpath ('cookie.txt ');
$ Id = $ _ GET ['id'];
$ Password = $ _ GET ['password'];
$ Year = $ _ GET ['Year'];
$ Term = $ _ GET ['term '];
$ Ch = curl_init ();
$ Login_url = "http: // 211.67.32.51 /";
$ CurlPost = "_ VIEWSTATE = signature % 2BO2w8bzxmPjs % 2BPjs7Pjs % signature % 2BOz4% 2 BOzs % 2BOz4% signature % 2 FCbCuTw % 3D & tbYHM = k061138526 & tbPSW = 100311 & ddlSF = students & imgDL. x = 0 & imgDL. y = 0 ";
$ CurlPost = iconv ("UTF-8", "GBK", $ curlPost );
Curl_setopt ($ ch, CURLOPT_URL, $ login_url );
// When enabled, the header file information is output as a data stream.
Curl_setopt ($ ch, CURLOPT_PROXY, 'jackdowosn .gnway.net: 81 ');
Curl_setopt ($ ch, CURLOPT_HEADER, 0 );
Curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 1 );
Curl_setopt ($ ch, CURLOPT_REFERER, 'http: // 211.67.32.51 /');
Curl_setopt ($ ch, CURLOPT_POST, 1 );
Curl_setopt ($ ch, CURLOPT_POSTFIELDS, $ curlPost );
// Sets the file for storing cookie information after the connection ends.
Curl_setopt ($ ch, CURLOPT_COOKIEJAR, $ cookiejar );
$ Data = curl_exec ($ ch );
$ Data = mb_convert_encoding ($ data, "UTF-8", "gbk ");
// Echo $ data;
Echo' '. Search3 ($ id, $ year, $ term, $ ch ).' ';
?>
But he still returned
String (150 )"
Object moved to here.
"
After I submit the value of _ VIEWSTATE, the system returns the Object moved to here ...... can you give me some experience?
I have not solved this problem.
$ CurlPost = "_ VIEWSTATE = signature % 2BO2w8bzxmPjs % 2BPjs7Pjs % signature % 2BOz4% 2 BOzs % 2BOz4% signature % 2 FCbCuTw % 3D & tbYHM = k061138526 & tbPSW = 100311 & ddlSF = students & imgDL. x = 0 & imgDL. y = 0 "; $ curlPost = iconv (" UTF-8 "," GBK ", $ curlPost );
Hello, my current source code is like this. Header ("content-Type: text/html; charset = utf-8 ");
Require_once 'search. php ';
// Step 1: submit data, generate a cookie, and save the cookie in the temporary directory
$ Cookiejar = realpath ('cookie.txt ');
$ Id = $ _ GET ['id'];
$ Password = $ _ GET ['password'];
$ Year = $ _ GET ['Year'];
$ Term = $ _ GET ['term '];
$ Ch = curl_init ();
$ Login_url = "http: // 211.67.32.51 /";
$ CurlPost = "_ VIEWSTATE = signature % 2BO2w8bzxmPjs % 2BPjs7Pjs % signature % 2BOz4% 2 BOzs % 2BOz4% signature % 2 FCbCuTw % 3D & tbYHM = k061138526 & tbPSW = 100311 & ddlSF = students & imgDL. x = 0 & imgDL. y = 0 ";
$ CurlPost = iconv ("UTF-8", "GBK", $ curlPost );
Curl_setopt ($ ch, CURLOPT_URL, $ login_url );
// When enabled, the header file information is output as a data stream.
Curl_setopt ($ ch, CURLOPT_PROXY, 'jackdowosn .gnway.net: 81 ');
Curl_setopt ($ ch, CURLOPT_HEADER, 0 );
Curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 1 );
Curl_setopt ($ ch, CURLOPT_REFERER, 'http: // 211.67.32.51 /');
Curl_setopt ($ ch, CURLOPT_POST, 1 );
Curl_setopt ($ ch, CURLOPT_POSTFIELDS, $ curlPost );
// Sets the file for storing cookie information after the connection ends.
Curl_setopt ($ ch, CURLOPT_COOKIEJAR, $ cookiejar );
$ Data = curl_exec ($ ch );
$ Data = mb_convert_encoding ($ data, "UTF-8", "gbk ");
// Echo $ data;
Echo' '. Search3 ($ id, $ year, $ term, $ ch ).' ';
?>
But he still returned
String (150 )"
Object moved to here.
"
Daxian, how does your login_url end with default3.aspx? didn't you see the action attribute in the form?
$ CurlPost = "_ VIEWSTATE = signature % 2BO2w8bzxmPjs % 2BPjs7Pjs % signature % 2BOz4% 2 BOzs % 2BOz4% signature % 2 FCbCuTw % 3D & tbYHM = k061138526 & tbPSW = 100311 & ddlSF = students & imgDL. x = 0 & imgDL. y = 0 "; $ curlPost = iconv (" UTF-8 "," GBK ", $ curlPost );
Hello, my current source code is like this. Header ("content-Type: text/html; charset = utf-8 ");
Require_once 'search. php ';
// Step 1: submit data, generate a cookie, and save the cookie in the temporary directory
$ Cookiejar = realpath ('cookie.txt ');
$ Id = $ _ GET ['id'];
$ Password = $ _ GET ['password'];
$ Year = $ _ GET ['Year'];
$ Term = $ _ GET ['term '];
$ Ch = curl_init ();
$ Login_url = "http: // 211.67.32.51 /";
$ CurlPost = "_ VIEWSTATE = signature % 2BO2w8bzxmPjs % 2BPjs7Pjs % signature % 2BOz4% 2 BOzs % 2BOz4% signature % 2 FCbCuTw % 3D & tbYHM = k061138526 & tbPSW = 100311 & ddlSF = students & imgDL. x = 0 & imgDL. y = 0 ";
$ CurlPost = iconv ("UTF-8", "GBK", $ curlPost );
Curl_setopt ($ ch, CURLOPT_URL, $ login_url );
// When enabled, the header file information is output as a data stream.
Curl_setopt ($ ch, CURLOPT_PROXY, 'jackdowosn .gnway.net: 81 ');
Curl_setopt ($ ch, CURLOPT_HEADER, 0 );
Curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 1 );
Curl_setopt ($ ch, CURLOPT_REFERER, 'http: // 211.67.32.51 /');
Curl_setopt ($ ch, CURLOPT_POST, 1 );
Curl_setopt ($ ch, CURLOPT_POSTFIELDS, $ curlPost );
// Sets the file for storing cookie information after the connection ends.
Curl_setopt ($ ch, CURLOPT_COOKIEJAR, $ cookiejar );
$ Data = curl_exec ($ ch );
$ Data = mb_convert_encoding ($ data, "UTF-8", "gbk ");
// Echo $ data;
Echo' '. Search3 ($ id, $ year, $ term, $ ch ).' ';
?>
But he still returned
String (150 )"
Object moved to here.
"
Daxian, how does your login_url end with default3.aspx? didn't you see the action attribute in the form?
It is useless to change it.
Is the problem solved? I am also working on data capture in the modern square, but I have never been able
_ VIEWSTATE changes. obtain it.