0

This is the url: https://scontent.xx.fbcdn.net/v/t34.0-12/15749870_10153984148031541_865898377_n.jpg?_nc_ad=z-m&oh=73dc146bd7d8922a41c262ecc2299bb4&oe=58659947

I want to save Facebook images to my server. I tried many options such as copy, file_get_contents etc. What happens is that i get a blank image file that has 0 file size.

How do i save/copy facebook image url to my server as an image?

ejobity
  • 305
  • 1
  • 3
  • 13
  • Perhaps your server cannot open remote files. Check if allow_url_fopen is disabled on your php.ini – Alex Dec 27 '16 at 21:10
  • I checked. Yes it is enabled. – ejobity Dec 27 '16 at 22:05
  • Im now seeing my error it works. All save image works. What is happenings is i am using GET and storing the remote url value into a variable and because the string as other = and & in it, im not getting the complete value to be processed. So i have to find out how to GET the entire url. – ejobity Dec 27 '16 at 22:43

1 Answers1

0

Try:

$url = "https://scontent.xx.fbcdn.net/v/t34.0-12/15749870_10153984148031541_865898377_n.jpg?_nc_ad=z-m&oh=73dc146bd7d8922a41c262ecc2299bb4&oe=58659947";

$img = './your_image_name.jpg';
file_put_contents($img, file_get_contents($url));
Łukasz D. Tulikowski
  • 1,440
  • 1
  • 17
  • 36