-
Notifications
You must be signed in to change notification settings - Fork 0
/
flickr.php
33 lines (28 loc) · 976 Bytes
/
flickr.php
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
<?php
require_once( './config.php' );
$lang = "de";
$count = 50;
$userid = $flickr_user; //
$user = $flickr_user_name; //
$apiurl = "http://api.flickr.com/services/rest/?method=flickr.people.getPublicPhotos"
."&user_id=".$userid
."&per_page=".$count."&page=1&format=feed-atom_10"
."&api_key=".$flickr_api_key;
$timeout = 15;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $apiurl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, $timeout );
curl_setopt( $ch, CURLOPT_TIMEOUT, $timeout );
$output = curl_exec($ch);
curl_close($ch);
$rawData = trim($output);
//if OK?
$response = $rawData;
// print_r($response);
if ($response != "") {
$data = $response;
$data = str_replace( '_m.jpg"', '_z.jpg"', $data );
$data = str_replace( '<p><a href="http://www.flickr.com/people/'.$userid.'/">'.$user.'</a> posted a photo:</p>', '', $data );
echo $data;
}