E
E
EvGenius Karlonius2017-02-09 04:09:35
PHP
EvGenius Karlonius, 2017-02-09 04:09:35

How to isolate and display facebook user's photo from API response?

got a response from facebook

[gender] => male
[locale] => ru_RU
[picture] => stdClass Object
(
[data] => stdClass Object
(
[is_silhouette] =>
[url] => https://scontent.xx.fbcdn.net/ oh= b888c2ab8cb0ddeeb65b3cb2f34520d6 &oe=67FED890
) ) [ timezone] =>2

$f = $j -> picture -> data -> url;
What data (if an example is possible) should be taken to display/download a picture in order to display the picture and not violate any Facebook rules?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor Agarkov, 2017-02-17
@id01

I don’t know what Facebook’s rules are, but to solve a similar problem with the VKontakte resource, I simply took the url of the image and inserted it directly into the html. Something like this:
I took the html code of a block with a picture from a tpl file.
Then, in a puff, I replaced %url% with, in fact, the url itself and displayed the resulting code on the screen:

$html = str_replace("%url%", $url, $html);
echo $html;

You don't need to download the image. What for? You just paste the url and the user just sees a beautiful (hopefully) result.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question