Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts

    getting a remove webpage?

    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

  • #2
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    hmm,
    trying to use this:

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


    but just gives me :
    Resource id #3


    any ideas?

    -Ken

  • #3
    Senior Coder NancyJ's Avatar
    Join Date
    Feb 2005
    Location
    Bradford, UK
    Posts
    3,174
    Thanks
    19
    Thanked 66 Times in 65 Posts
    try

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


  • #4
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    ah ok,
    this seems to work:

    PHP Code:
    $handle fopen("http://www.remixwars.com""r");
    while (!
    feof($handle)) {
       
    $buffer fgets($handle10000);
       echo 
    $buffer;
    }
    fclose($handle); 
    but if anyone has a better way to do this please let me know,
    -Ken

  • #5
    Senior Coder NancyJ's Avatar
    Join Date
    Feb 2005
    Location
    Bradford, UK
    Posts
    3,174
    Thanks
    19
    Thanked 66 Times in 65 Posts
    heh we posted at the same time

  • #6
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    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:
    PHP Code:
    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:

    PHP Code:
    <?
     
    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

  • #7
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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..
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •