...

View Full Version : getting a remove webpage?



angst
09-14-2005, 09:38 PM
Hi,
I'm trying to find a way to pull a webpage from a remote site and show is on my site, in ASP I'd use httpxml, is there something like this for PHP?

if so, could someone point me in the right direction?

thanks in advance for your time!
-Ken

angst
09-14-2005, 09:41 PM
hmm,
trying to use this:

echo fopen("http://www.remixwars.com/", "r");


but just gives me :
Resource id #3


any ideas?

-Ken

NancyJ
09-14-2005, 09:45 PM
try



$file = file("http://www.remixwars.com/") ;
foreach($file as $line){
echo $line;
}

angst
09-14-2005, 09:45 PM
ah ok,
this seems to work:



$handle = fopen("http://www.remixwars.com", "r");
while (!feof($handle)) {
$buffer = fgets($handle, 10000);
echo $buffer;
}
fclose($handle);



but if anyone has a better way to do this please let me know,
-Ken

NancyJ
09-14-2005, 09:46 PM
heh we posted at the same time :)

angst
09-14-2005, 09:55 PM
haha, maybe you can help me with one more question,


I'm trying to write this code to a index.php file when i generate directories on my site,

like:


fwrite($handle, "
<?
$file = file('http://www.loveport.com/?page=sublist&cat=$row[cid]');
foreach($file as $line){
echo $line;
}
?>
");
fclose($handle);


which seems to kind of work, but it takes some if the code out and leaves me with this inside the index.php file:



<?
= file('http://www.loveport.com/?page=sublist&cat=1');
foreach( as ){
echo ;
}
?>


seems to remove anything with a $ in front of it,
any ideas on how to get around this??

thanks again for your time!
-Ken

raf
09-14-2005, 11:18 PM
you enclosed the second argument of your fwrite in double quotes. so it get parsed, and every variable is replaced by it's value. Replace your double quotes with single ones, and your single ones with double ones if you don't want the string to be parsed..



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum