kish89 Posted September 11, 2008 Share Posted September 11, 2008 Hello, How can I automticly login to this site http://www.aukcije.hr/user_login.php I need to fetch some data from user area, but script first needs to login. Thanks. Link to comment https://forums.phpfreaks.com/topic/123835-login-to-form/ Share on other sites More sharing options...
GingerRobot Posted September 11, 2008 Share Posted September 11, 2008 Try cURL Link to comment https://forums.phpfreaks.com/topic/123835-login-to-form/#findComment-639380 Share on other sites More sharing options...
lemmin Posted September 11, 2008 Share Posted September 11, 2008 You would have to change the Content-Length for the length of your login info, but I think this would work. $fp = fsockopen("www.aukcije.hr", 80, $errno, $errstr, 30); if (!$fp) echo "$errstr ($errno)<br />\n"; else { $out = "POST /user_login.php HTTP/1.1\r\n"; $out .= "Host: www.aukcije.hr\r\n"; $out .= "Content-Type: application/x-www-form-urlencoded\r\n"; $out .= "Content-Length: 35\r\n"; $out .= "username=youruname\r\n"; $out .= "password=yourpass\r\n"; fwrite($fp, $out); $fbuff = ""; while (!feof($fp)) $fbuff .= fgets($fp, 128); fclose($fp); Link to comment https://forums.phpfreaks.com/topic/123835-login-to-form/#findComment-639382 Share on other sites More sharing options...
kish89 Posted September 11, 2008 Author Share Posted September 11, 2008 Ive got this: Fatal error: Maximum execution time of 60 seconds exceeded in C:\xampp\htdocs\xampp\aukcije\login.php on line 18 Link to comment https://forums.phpfreaks.com/topic/123835-login-to-form/#findComment-639388 Share on other sites More sharing options...
lemmin Posted September 11, 2008 Share Posted September 11, 2008 That probably means that their server didn't recognize something in the packet. Make sure you are using the right Content-Length. Link to comment https://forums.phpfreaks.com/topic/123835-login-to-form/#findComment-639413 Share on other sites More sharing options...
kish89 Posted September 12, 2008 Author Share Posted September 12, 2008 I've wrote good content lenght. I need only to count this, right? $out .= "Content-Length: 33 \r\n"; $out .= "username=xxxx89\r\n"; $out .= "password=xxxxxxxxx\r\n"; Link to comment https://forums.phpfreaks.com/topic/123835-login-to-form/#findComment-639616 Share on other sites More sharing options...
lemmin Posted September 12, 2008 Share Posted September 12, 2008 Woops, I guess you need to end the packet info part. Put another \r\n at the end of the Content-Length line: $out .= "Content-Length: 33 \r\n\r\n"; You will also want to echo out $fbuff to see what their server actually returns. Link to comment https://forums.phpfreaks.com/topic/123835-login-to-form/#findComment-639821 Share on other sites More sharing options...
kish89 Posted October 23, 2008 Author Share Posted October 23, 2008 Now i dont have any errors. Only blank page. And it's not logged in.. Link to comment https://forums.phpfreaks.com/topic/123835-login-to-form/#findComment-673014 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.