-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGetFBCover.php
More file actions
51 lines (44 loc) · 1.4 KB
/
GetFBCover.php
File metadata and controls
51 lines (44 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
/*
Editado: Parece que facebook cambió las politicas de seguridad
y ahora pide un token para obtener la data
*/
/**************************************/
$fotos = array();
//Obtener datos de facebook
for ($i = 0; $i < 500; $i++) {
$foto = @file_get_contents("https://graph.facebook.com/" . $i . "?fields=cover");
if (!empty($foto)) {
$objFoto = json_decode($foto);
if (is_object($objFoto)) {
$propiedades = get_object_vars($objFoto);
if (!empty($objFoto->cover))
if (!empty($objFoto->cover->source))
$fotos[] = $objFoto->cover;
}
}
}
echo "<div style='margin:0px auto;'>";
$i = 0;
foreach ($fotos as $foto) {
if (is_object($foto))
echo "<img src='" . $foto->source . "' height='100' width='100' align='left' />";
}
echo "</div>";
/*
//De aca para abajo anda bien!
$graph = file_get_contents("https://graph.facebook.com/facundo.giardino.1?fields=cover");
$obj = json_decode($graph)->cover;
//print_r($obj);
echo "<img src='".$obj->source."' height='100' width='100' />";
$datos = str_replace("}", "", (str_replace("{", "", $graph)));
$datos = explode(",", $datos);
$arrayFinal = array();
foreach($datos as $dato){
$oldAndNewValue = explode(":", $dato);
$arrayFinal [$oldAndNewValue[0]] = $oldAndNewValue[1];
}
echo "<pre>";
print_r($arrayFinal);
echo "<hr/>";
/**************************************/