0
我想通过httpwebrequest登录本网站https://www.bewickedcostumes.com/login.php。使用httpwebrequest登录
//这里是GET
https://www.bewickedcostumes.com/login.php?open_in_layer=Y&is_ajax_request=Y&keep_https=Y GET /login.php?open_in_layer=Y&is_ajax_request=Y&keep_https=Y HTTP/1.1 Host: www.bewickedcostumes.com User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:14.0) Gecko/20100101 Firefox/14.0.1 Accept: */* Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip, deflate Connection: keep-alive X-Requested-With: XMLHttpRequest Referer: https://www.bewickedcostumes.com/login.php Cookie: store_language=en; __atuvc=22%7C31%2C14%7C32; RefererCookie=http%3A%2F%2Fwww.bewickedcostumes.com%2Fproduct.php%3Fproductid%3D18078%26cat%3D%26bestseller%3DY; GreetingCookie=Sammy+Chan; xid_d9db5C_remember=schan%40dropshipinc.com; xid_d9db5=21e18e3615c5ed2ef0597789bcd74746 If-Modified-Since: Wed, 08 Aug 2012 01:49:39 GMT
HTTP/1.1 200 OK Date: Wed, 08 Aug 2012 02:10:57 GMT Server: Apache Expires: Mon, 26 Jul 1997 05:00:00 GMT Cache-Control: private, must-revalidate P3P: CP="NON CURa ADMa DEVa TAIa CONi OUR DELa BUS IND PHY ONL UNI PUR COM NAV DEM STA" Set-Cookie: xid_d9db5=21e18e3615c5ed2ef0597789bcd74746; path=/; domain=www.bewickedcostumes.com; httponly Last-Modified: Wed, 08 Aug 2012 02:10:57 GMT Vary: Accept-Encoding,User-Agent Content-Encoding: gzip Content-Length: 1220 Keep-Alive: timeout=5, max=99 Connection: Keep-Alive Content-Type: text/html; charset=iso-8859-1
//这里是POST
https://www.bewickedcostumes.com/login.php?open_in_layer=Y&is_ajax_request=Y&keep_https=Y POST /login.php?open_in_layer=Y&is_ajax_request=Y&keep_https=Y HTTP/1.1 Host: www.bewickedcostumes.com User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:14.0) Gecko/20100101 Firefox/14.0.1 Accept: */* Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip, deflate Connection: keep-alive Content-Type: application/x-www-form-urlencoded; charset=UTF-8 X-Requested-With: XMLHttpRequest Referer: https://www.bewickedcostumes.com/login.php Content-Length: 119 Cookie: store_language=en; __atuvc=22%7C31%2C14%7C32; RefererCookie=http%3A%2F%2Fwww.bewickedcostumes.com%2Fproduct.php%3Fproductid%3D18078%26cat%3D%26bestseller%3DY; GreetingCookie=Sammy+Chan; xid_d9db5C_remember=schan%40dropshipinc.com; xid_d9db5=21e18e3615c5ed2ef0597789bcd74746 Pragma: no-cache Cache-Control: no-cache xid_d9db5=21e18e3615c5ed2ef0597789bcd74746&is_remember=&mode=login&username=schan%40dropshipinc.com&password=4700Miller
HTTP/1.1 200 OK Date: Wed, 08 Aug 2012 02:11:06 GMT Server: Apache Expires: Mon, 26 Jul 1997 05:00:00 GMT Cache-Control: private, must-revalidate P3P: CP="NON CURa ADMa DEVa TAIa CONi OUR DELa BUS IND PHY ONL UNI PUR COM NAV DEM STA" Set-Cookie: xid_d9db5=21e7b58ed5b06ad7d5897ad641186f8b; path=/; domain=www.bewickedcostumes.com; httponly Set-Cookie: GreetingCookie=Sammy+Chan; expires=Mon, 04-Feb-2013 02:11:06 GMT; path=/; domain=www.bewickedcostumes.com; httponly Last-Modified: Wed, 08 Aug 2012 02:11:06 GMT Vary: Accept-Encoding,User-Agent Content-Encoding: gzip Content-Length: 193 Keep-Alive: timeout=5, max=100 Connection: Keep-Alive Content-Type: text/html; charset=iso-8859-1
我的代码可以登录网站很多,但与这个网站没有关系”工作。
检查的形式隐藏字段。你可能会错过一个。 – Blender 2012-08-08 02:33:54