Page 1 of 1

fopen - trouble reading in entire file

Posted: Thu Aug 28, 2003 8:51 pm
by Saxywolf
I'm having trouble with fopen. This is the site I'm testing it on:

http://myplanetside.station.sony.com/ou ... worldId=16

The first 41 lines of page source will be read, but then it stops.

If I copy the 3946 lines of page source and save it to a .txt file on my server the entire file will be read.

Posted: Thu Aug 28, 2003 9:08 pm
by McGruff
Windows server? Try adding a "b":

Code: Select all

<?php
$fp = fopen('.. file path .. ', "rb");
?>
(got that from user comments on http://uk2.php.net/manual/en/function.fopen.php)

Posted: Thu Aug 28, 2003 9:27 pm
by Saxywolf
A friend telneted into the Sony server and apparently it is expecting some cookie information or somthin...

He telneted some info back after packet sniffin (or somthing, possibly with a program called Ethereal).

I may have to use raw sockets rather then fopen.

but I have no idea what "Raw Sockets" even means (relating to PHP programming anyway)

Posted: Thu Aug 28, 2003 10:09 pm
by Saxywolf

Code: Select all

$file = fsockopen ("myplanetside.station.sony.com", 80, $errno, $errstr, 30);

if (!$file)
&#123;
	echo "$errstr ($errno)</br>";
&#125;
else
&#123;
	fputs ($file, "GET /outfit.jsp?outfitId=6723&worldId=16 HTTP/1.1\r\n");
	fputs ($file, "Host: myplanetside.station.sony.com\r\n");
	fputs ($file, "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n\r\n");
&#125;
My friend is a genius. Hope this helps someone else.