Virtual Brain Online Logo

Bookmark: Root \ PHP \ Talk to Webserver directly

Talk to Webserver directly

Last Updated: 2005-12-20

I have found this on I have not tested it yet but I will eventually.

function sendToSocket($server,$send)
$fp = fsockopen ($server, 80, $errno, $errstr);
if (!$fp)
$result = "$errstr ($errno)\r\n";
fputs ($fp, "$send\r\n\r\n");


while (!feof($fp))
$res=fgets ($fp,1024);

$content .= $res;
$header .= $res;
return $content;

//Settings to fetch file
function fetchWebPage($PATH)
$agent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)";
$PATH = trim($PATH);
$TEMP = parse_url($PATH);
$path = $TEMP['path'].'?'.$TEMP['query'];
$server = $TEMP['host'];
$send = "GET $path HTTP/1.0
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/, application/, application/msword, application/x-shockwave-flash,
Referer: $PATH
Accept-Language: en-us
Accept-Encoding: gzip, deflate
User-Agent: $agent
Host: $server
Connection: Keep-Alive
Cache-Control: no-cache";

$HTML = sendToSocket($server, $send, $FLAG);
return $HTML;

Use the above 2 function(PHP code) and save in a file.

With regards,
Last update by Skylinux @ 2005-12-20 00:14:34


No Comments yet .....


Add Your Comment:

Note: All posts require administrator approval. Please allow 24 hours for message approval.

Plain text only, less then 65 000 characters.

How many apples does Peter have left if Peter has 25 apples but little Jane eats one of his apples?

Please answer the question above and type the answer into the text box below.