PHP Web Fetching

wrongforumwrongforum BeginnerLink Clerk
Hi,

Im pretty good at PHP but i want to learn more about Web Fetching, Im just wondering if anyone know's any good sites that aid you with Web Fetching and help you learn the in's and out's of it.

- Thanks.

Comments

  • dabossdaboss WP V.I.P. ''The Boss'' Administrator
    i'm assuming you mean getting the php script to copy out the content of a url and parsing through the contents...

    try this out:
    <?php 
    
           $url = "http://www.yoursite.com";
           $filepointer = fopen($url,"r");
           if($filepointer){
               while(!feof($filepointer)){
                   $buffer = fgets($filepointer, 4096);
                   $file .= $buffer;
               }
               fclose($filepointer);
           } else {
               die("Could not create a connection to yoursite.com");
           }
    
           // at this stage, the contents of http://www.yoursite.com is
           // in the $file variable. you can process it using PHP's string
           // functions.
    
    ?>
    
  • ForgeForge Senior Member The Royal RAM
    Believe it or not, this code works...

    [php]

    $url = "http://www.outpostgamers.com/images/header.jpg";

    if(copy($url, "images/header.jpg")){
    echo "File copied";
    }

    [/php]

    It works, they're might be an error but you get the idea...
    Can fat people Go skinny Dipping?
Sign In or Register to comment.