Jump to content

[SOLVED] socket


konnwat

Recommended Posts

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!  :o

 

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.