konnwat Posted May 25, 2007 Share Posted May 25, 2007 Hey i made a nice bot that opens a socket, gets some html, parses it and adds the information to a db. but... the site now needs you to be logged in to view the source! so how would i go about making it log in? :-\ i was thinking sending some headers to the socket that has the session cookie in them but i dont know how i would do that :-X here is my code... <?php $fp = fsockopen("www.barafranca.com", 80, $errno, $errstr, 30); if (!$fp) { echo "$errstr ($errno)<br />\n"; } else { $out = "GET /compress.php?r=stats.inc HTTP/1.1\r\n"; $out .= "Host: barafranca.com\r\n"; $out .= "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021204\r\n"; $out .= "Connection: Close\r\n\r\n"; $file = ''; fwrite($fp, $out); while (!feof($fp)) { $file .= fgets($fp, 128); } fclose($fp); } ?> Link to comment https://forums.phpfreaks.com/topic/53000-solved-socket/ Share on other sites More sharing options...
trq Posted May 26, 2007 Share Posted May 26, 2007 so how would i go about making it log in? It would be allot more practical to use the curl extension. Link to comment https://forums.phpfreaks.com/topic/53000-solved-socket/#findComment-261910 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.