如何解析fb图像网址到图像到$ _GET

时间:2016-07-26 20:48:57

标签: javascript php

如何将fb图片网址解析为$_GET?我使用的是javascript和php:

https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xaf1/v/t1.0-1/c0.8.50.50/p50x50/10418963_845746262178119_4978000552642842671_n.jpg?oh=21e838bf609a8f4b0137a786c7434ee3&oe=58144D56&__gda__=1479268869_857fd43604c037bdf53d104a318910c6

$image= $_GET[picture];

2 个答案:

答案 0 :(得分:0)

$source="https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xaf1/v/t1.0-1/c0.8.50.50/p50x50/10418963_845746262178119_4978000552642842671_n.jpg?oh=21e838bf609a8f4b0137a786c7434ee3&oe=58144D56&__gda__=1479268869_857fd43604c037bdf53d104a318910c6";

$target="server_file_path/image.jpg";//location and name on local server, may not be a jpg, you need to check the file type.

$Img = file_get_contents($source); //get the image from the remote server

file_put_contents($target, $Img); //save the image locally

答案 1 :(得分:0)

您可以使用

file_get_contents($file)

接受URI