fopen - trouble reading in entire file

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Saxywolf
Forum Newbie
Posts: 5
Joined: Thu Aug 28, 2003 8:51 pm

fopen - trouble reading in entire file

Post 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.
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post 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)
Last edited by McGruff on Wed Aug 10, 2005 8:32 pm, edited 1 time in total.
Saxywolf
Forum Newbie
Posts: 5
Joined: Thu Aug 28, 2003 8:51 pm

Post 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)
Saxywolf
Forum Newbie
Posts: 5
Joined: Thu Aug 28, 2003 8:51 pm

Post 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.
Post Reply