Пример #1
0
<?php

require '../src/Curl/Curl.php';
require 'flickr.class.php';
use Curl\Curl;
$flickr = new Flickr();
$flickr->authenticate();
?>
<!doctype html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Flickr Photo Upload</title>
</head>
<body>

<?php 
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $result = $flickr->uploadPhoto();
    if ($result->error) {
        echo '<p>Photo upload failed.</p>';
    } else {
        $user_id = $_SESSION['user_id'];
        $photo_id = $result->response->photoid;
        $photo_url = 'http://www.flickr.com/photos/' . $user_id . '/' . $photo_id;
        echo '<p>Photo uploaded successfully. <a href="' . $photo_url . '">View photo</a>.</p>';
    }
}
?>

<form enctype="multipart/form-data" method="post">