Page 1 of 1

Reading part of a page....

Posted: Thu Nov 07, 2002 5:07 am
by Tubby
I'm using this to gather info from a page:

Code: Select all

<?php
$page = fopen("pageinfo.php", "r");
$html = fread($page, 800); //number of characters to get
fclose($page);
echo "$html";
?>
But I want to tell it not to get the info from the top of the page, but from a certain line of code onwards...
line of code where the info starts:

Code: Select all

<table width=468 cellpadding=0 cellspacing=0 border=0>
however, I can't edit the source page because it isn't mine (but using it with their permission) and the line of code I want it to start reading from isn't always on the same line number, because above it is a live news feed which varies in length every hour.
Is this possible, if so could someone tell me how :D

thanks.

Posted: Thu Nov 07, 2002 6:47 am
by qads
well, if <table> tag is the only one in that file then you can search for it and then get the character number, then load from there........did u get that? :roll:

Posted: Thu Nov 07, 2002 6:47 am
by volka

Code: Select all

...
fclose($page);
$output = strstr($html,'&lt;table width=468 cellpadding=0 cellspacing=0 border=0&gt;');
echo $output; // no need for quotes
http://www.php.net/manual/en/function.strstr.php

Posted: Thu Nov 07, 2002 6:48 am
by qads
lol..that's what i said!

Posted: Thu Nov 07, 2002 6:50 am
by volka
take a look at the post times ;)

Posted: Thu Nov 07, 2002 7:00 am
by Tubby
About 5 mins after posting that message I found what I wanted in the php manual :oops:

Thanks anyway :D

Posted: Thu Nov 07, 2002 7:53 am
by qads
hmm....i wish i could slap you..lol..just jokein :P

Posted: Thu Nov 07, 2002 8:41 am
by Tubby
hehehe :D
I'd been looking all morning and couldnt find what I wanted. Asked here, then looked again in the same place and found it, always happens like that :lol: