Fetching a file..? Help

Discussion in 'PHP' started by terryuk, May 15, 2006.

  1. #1
    Hi, im wondering how i can make my new script fetch a file from another website. For example, i'd be adding graphics into a database, but rather than uploading the image if i provide a link to the image, it will then download the image onto my server..

    Any ideas on how to do this?

    Thanks
     
    terryuk, May 15, 2006 IP
  2. Dan Grossman

    Dan Grossman Peon

    Messages:
    177
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If your host allows it, most of PHP's filesystem functions will accept URLs as paths:

    $image_data = file_get_contents("http://www.example.com/image.gif");
     
    Dan Grossman, May 23, 2006 IP
  3. discoverclips

    discoverclips Peon

    Messages:
    491
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #3
    or you can try wget ?
     
    discoverclips, May 24, 2006 IP
  4. Veselin Stoilov

    Veselin Stoilov Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    take a look at:
    http://php.net/curl
    you can use proxy and hide your IP :)
     
    Veselin Stoilov, Jun 6, 2006 IP
  5. terryuk

    terryuk Notable Member

    Messages:
    3,962
    Likes Received:
    319
    Best Answers:
    0
    Trophy Points:
    255
    #5
    Cheers :) got it a while ago, but forgot to post and say :rolleyes:
     
    terryuk, Jun 6, 2006 IP