Exemple #1
0
</form>
<br>

<h4><b>Response<b></h4>
<?php 
$photo_id = $_POST['photo_id'];
$secret = $POST['secret'];
if ($secret == NULL) {
    $options = array("photo_id" => $photo_id);
} else {
    $options = array("photo_id" => $photo_id, "secret" => $secret);
}
$flicker_client = new FlickrClient($api_key);
switch ($method) {
    case 'flickr.photos.getInfo':
        $photo_info = $flicker_client->GetPhotoInfo($options);
        break;
    case 'flickr.photos.getFavorites':
        $photo_info = $flicker_client->GetPhotoFevorite($options);
        break;
    case 'flickr.photos.getPerms':
        $photo_info = $flicker_client->GetPhotoPerms($options);
        break;
    case 'flickr.photos.getRecent':
        $photo_info = $flicker_client->GetPhotoRecent;
        break;
    case 'flickr.photos.getSizes':
        $photo_info = $flicker_client->GetPhotoSizes($options);
        break;
}
echo "<textarea name=\"res\" cols=\"100\" rows=\"20\" value={$photo_info}></textarea>";
Exemple #2
0
<?php

require_once "FlickrClient.php";
session_start();
ob_start();
$api_key = $_SESSION["key"];
$method = $_SESSION["method"];
$photo_id = $_GET["id"];
$url = $_GET["url"];
$comment = $_GET["comment"];
ob_end_flush();
$options = array("photo_id" => $photo_id);
$flicker_client = new FlickrClient($api_key);
$res_xml = $flicker_client->GetPhotoInfo($options);
$special = array('&lt;', '&quot;', '&gt;');
$replace = array('<', '"', '>');
$str = str_replace($special, $replace, $res_xml);
$xml = <<<XML
<?xml version="1.0"?>
{$str}
XML;
file_put_contents("/tmp/xml.txt", $xml);
$tags = array();
$XML = new SimpleXMLElement($xml);
$username = (string) $XML->photo->owner['username'];
$title = (string) $XML->photo->title;
$description = (string) $XML->photo->description;
$comments = (string) $XML->photo->comments;
foreach ($XML->photo->tags->tag as $tag) {
    array_push($tags, $tag);
}