Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple way to grab web page?

Status
Not open for further replies.

angst

IS-IT--Management
Feb 15, 2002
4
CA
Hello,
I'm looking for a simple way to grab info from a web page over the net using php?

is there a way to do this and if so could some one give me an example of how to it?

thanks in advance for yuor time!
 
$file = "$fp = fopen($file);
$contents = fread($fp, filesize($file));

You'll have to sort out the header info and other stuff that HTTP1.0 carries with it, but it works --BB
 
hmm,ok I try using this code:

<?
$file = &quot;<$fp = fopen($file);
$contents = fread($fp, filesize($file));
?>

but it keeps coming up with an error:


Parse error: parse error in c:\inetpub\ on line 5

any ideas what I'm doing wrong,??

thanks for your time!:)
 
you dont want the
Code:
<
or the
Code:
>
around the url... you also forgot a trailing quote... Anikin has the right idea... use his code. Both examples will work though :) -gerrygerry
Go To
 
my code has a semicolon more than needed ...

$file=implode(&quot;&quot;,file(&quot;this is the right code.

another thing, the fact of having 2 semicolons in a row is not the bug. he forgot to close the double quotes. That's the parse error. Anikin
Hugo Alexandre Dias
Web-Programmer
anikin_jedi@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top