예제 #1
0
#!/usr/bin/env php
<?php 
require_once 'fotolia-api.php';
$api = new Fotolia_Api('your_api_key');
// searching for files
$results = $api->getSearchResults(array('words' => 'car', 'language_id' => Fotolia_Api::LANGUAGE_ID_EN_US, 'limit' => 1));
printf("Found %d results", $results['nb_results']);
foreach ($results as $key => $value) {
    // iterating only over numeric keys and silently skip other keys
    if (is_numeric($key)) {
        printf("matching media ID: %d", $value['id']);
    }
}
// loggin in and retrieving user data
$api->loginUser('your_login', 'your_password');
print_r($api->getUserData());
// purchasing and downloading a file
$dl_data = $api->getMedia(35957426, 'XS');
$api->downloadMedia($dl_data['url'], '/tmp/' . $dl_data['name']);
예제 #2
0
파일: prueba.php 프로젝트: repromores/Web2
<?php

include "fotolia-lib.php";
$api = new Fotolia_Api('svBKgX7unls2Y7abxY9pRe8hJacn5MAn');
// searching for files
$results = $api->getSearchResults(array('words' => 'avion', 'language_id' => Fotolia_Api::LANGUAGE_ID_ES_ES, 'limit' => 10));
printf("Found %d results", $results['nb_results']);
foreach ($results as $key => $value) {
    // iterating only over numeric keys and silently skip other keys
    if (is_numeric($key)) {
        //$url = $api->getMediaComp($value['id']);
        print_r($key);
        echo '<img src="' . $key["thumbnail_url"] . '">';
    }
}