I have to copy JPG from an external server, such as Facebook, to my server.
What is the best way to do so? I though maybe with fread/fopen etc. but I don't know if it is the best way.
I have to copy JPG from an external server, such as Facebook, to my server.
What is the best way to do so? I though maybe with fread/fopen etc. but I don't know if it is the best way.
You can use URLs with most filesystem functions (like copy).
$url = "http://cdn.sstatic.net/stackoverflow/img/sprites.png"; $target = "/tmp/stackoverflow.png"; copy($url, $target); Do note that you need to have the php.ini setting allow_url_fopen enabled.