mr_zhang Posted June 27, 2007 Share Posted June 27, 2007 Hi, I'm trying to login to delirious via script and I can't. I've tried using CURL and it is also not working. I then try to post manually. It's also still not working. Anybody can help? <html> <head> </head> <body> <? $url_info=parse_url('http://de.lirio.us/login/'); $referrer=$_SERVER["SCRIPT_URI"]; $data='username=user&password=pass&keeppass=&query='; //I've tried with(not working also): //$data='username=user&password=pass'; $url_info['port']=80; $request="POST ".$url_info['path']." HTTP/1.1\n"; $request.="Host: ".$url_info["host"]."\n"; $request.="Referer: $referer\n"; $request.="Content-type: application/x-www-form-urlencoded\n"; $request.="Content-length: ".strlen($data)."\n"; $request.="Connection: close\n"; $request.="\n"; $request.=$data."\n"; $fp = fsockopen($url_info["host"],$url_info["port"]); fputs($fp, $request); while(!feof($fp)) { //Get Body $result .= fgets($fp, 8192); }//while(!feof($fp)) fclose($fp); echo $result; ?> </body> </html> Link to comment https://forums.phpfreaks.com/topic/57418-help-http-post-is-not-working/ Share on other sites More sharing options...
trq Posted June 27, 2007 Share Posted June 27, 2007 It's also still not working. Give details. Link to comment https://forums.phpfreaks.com/topic/57418-help-http-post-is-not-working/#findComment-284043 Share on other sites More sharing options...
mr_zhang Posted June 27, 2007 Author Share Posted June 27, 2007 Give details. Well, as you can see, I'm trying to login by php, not manually by hand. However, the result from fgets() is the login form (not logged in). So, it does get the login page correctly. However, it does not logged in (which I want to do). It seems that the POST action is not sent. Any help? Link to comment https://forums.phpfreaks.com/topic/57418-help-http-post-is-not-working/#findComment-284054 Share on other sites More sharing options...
trq Posted June 27, 2007 Share Posted June 27, 2007 Well, for starters, I wouldn't be using $_SERVER["SCRIPT_URI"] as your referer. There end may have a check against the referer to stop people doing exactly what your attempting. Link to comment https://forums.phpfreaks.com/topic/57418-help-http-post-is-not-working/#findComment-284059 Share on other sites More sharing options...
mr_zhang Posted June 27, 2007 Author Share Posted June 27, 2007 Thanks Thorpe. After testing it, I still can't logged in. I've tried changing the referer to: - http://de.lirio.us/login/ (original login form if typed in browser. It's targetting itself.) - http://de.lirio.us/ Both still can't get me in. Any other suggestion? Link to comment https://forums.phpfreaks.com/topic/57418-help-http-post-is-not-working/#findComment-284076 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.