I cant save some facebook images to my server as it does not understand the file

后端 未结 2 1294
长情又很酷
长情又很酷 2021-01-17 04:26

I am using the facebook graph api and it was working well until I realised that some of the jpg files have a query string at the end that is making them unusable.

e.

2条回答
  •  有刺的猬
    2021-01-17 04:51

    You could always download the image using file_get_contents()

    This code works for me...

    file_put_contents("image.jpg", file_get_contents("https://scontent.xx.fbcdn.net/hphotos-xaf1/v/t1.0-9/522827_10152235166655545_26514444_n.jpg?oh=1d52a86082c7904da8f12920e28d3687&oe=5659D5BB"));
    

提交回复
热议问题