get_media_data doesn't work

30 views
Skip to first unread message

Moobys

unread,
May 8, 2008, 6:47:00 AM5/8/08
to Fotolia API
Hello,
script Get_media_data has returned error number 623 since yesterday.
This script error isn't described even in documentation. We cannot
display the details of any photo.

Thanks
Moo

Olivier Sirven

unread,
May 8, 2008, 6:59:39 AM5/8/08
to Fotol...@googlegroups.com
Hi,

Can you tell me more about this? Which API call specifically?

--
Olivier

Moobys

unread,
May 8, 2008, 8:02:25 AM5/8/08
to Fotolia API
Hello, this is the request and a response. api_key is all right, I've
checked it.

POST /Xmlrpc/rpc HTTP/1.0
Host: fr.fotolia.com
Connection: close
Content-Type: text/xml
Content-Length: 947

<?xml version="1.0" encoding="utf-8"?>
<methodCall>
<methodName>xmlrpc.getMediaData</methodName>
<params>
<param>
<value>
<struct>
<member>
<name>api_key</name>
<value>
<string>our api key</string>
</value>
</member>
</struct>
</value>
</param>
<param>
<value>
<struct>
<member>
<name>id</name>
<value>
<string>180699</string>
</value>
</member>
</struct>
</value>
</param>
<param>
<value>
<struct>
<member>
<name>thumbnail_size</name>
<value>
<int>110</int>
</value>
</member>
</struct>
</value>
</param>
<param>
<value>
<struct>
<member>
<name>language_id</name>
<value>
<int>2</int>
</value>
</member>
</struct>
</value>
</param>
</params>
</methodCall>




Received the following response:

HTTP/1.1 200 OK
Date: Thu, 08 May 2008 11:52:28 GMT
Server: Apache
X-Powered-By: PHP/5.2.5
Set-Cookie: PHPSESSID=deleted; expires=Wed, 09-May-2007 11:52:27 GMT;
path=/; domain=download.fotolia.com
Set-Cookie: PHPSESSID=416e2241527955e00c857076065f0be3; path=/;
domain=.fotolia.com
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-
check=0
Pragma: no-cache
Content-Length: 307
Connection: close
Content-Type: text/xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<methodResponse><fault><value><struct><member><name>faultCode</
name><value><int>623</int></value></member><member><name>faultString</
name><value><string>Calling parameters do not match signature</
string></value></member></struct></value></fault></methodResponse>

Moobys

unread,
May 8, 2008, 8:07:10 AM5/8/08
to Fotolia API
So I'm trying find some details about photos through getSearchResults
with media_id, but nb_result is 0 even if the number of the photo is
valid.
Please help. Thank You

Here is the query string

POST /Xmlrpc/rpc HTTP/1.0
Host: fr.fotolia.com
Connection: close
Content-Type: text/xml
Content-Length: 798

<?xml version="1.0" encoding="utf-8"?>
<methodCall>
<methodName>xmlrpc.getSearchResults</methodName>
<params>
<param>
<value>
<struct>
<member>
<name>api_key</name>
<value>
<string>key</string>
</value>
</member>
</struct>
</value>
</param>
<param>
<value>
<struct>
<member>
<name>language_id</name>
<value>
<int>2</int>
</value>
</member>
<member>
<name>thumbnail_size</name>
<value>
<int>400</int>
</value>
</member>
<member>
<name>media_id</name>
<value>
<int>3854186</int>
</value>
</member>
</struct>
</value>
</param>
</params>
</methodCall>

> > Olivier- Skrýt citovaný text -
>
> - Zobrazit citovaný text -

epir...@gmail.com

unread,
May 8, 2008, 4:59:40 PM5/8/08
to Fotolia API
Hi Moobys

we had a similar issue yesterday

it seems that there was a change at fotolia in xml rpc library and now
strict typing is enforced

<param>
<value>
<struct>
<member>
<name>id</name>
<value>

<string>180699</string>
</value>
</member>
</struct>
</value>
</param>

should be

<param>
<value>
<struct>
<member>
<name>id</name>
<value>
<int>180699</
int>
</value>
</member>
</struct>
</value>
</param>

Olivier Sirven

unread,
May 9, 2008, 5:45:49 AM5/9/08
to Fotol...@googlegroups.com
Hi,

The request fails because the first parameter should not be a string but
an integer. Try to replace the fotolia_api_client.php file with the
attached one, it should do the trick.

Olivier

fotolia_api_client.php

Olivier Sirven

unread,
May 9, 2008, 5:48:39 AM5/9/08
to Fotol...@googlegroups.com
Hi Moobys,

It's because the second parameter should be an integer (not a string).
There is a bug into fotolia_api_client.php of the php4 kit. So if you
are using it, please replace fotolia_api_client.php file with the
attached one.

Olivier

fotolia_api_client.php

Moobys

unread,
May 9, 2008, 10:26:02 AM5/9/08
to Fotolia API
Thak You,
i'm using it, GetMediaData it works now,
but the the LoginUser method doesn't work now, error 623 again.

Please fix it as soon as possible, we cannot order photos from
Fotolia, our webshop is out of order.
Thank You very much.

Moobys
> [fotolia_api_client.php]
> parameters set in the page like getSearchResults with serie_id set. var $forced_params; function fotoliaApiClient($api_key, $url, $path) { $this->api_key = $api_key; $this->url = $url; $this->path = $path; $this->search_params = array( 'keywords', 'words', 'language_id', 'color_name', 'creator_id', 'k', 'serie_id', 'model_id', 'similar_id', 'cat1_id', 'cat2_id', 'gallery_id', 'category_ids', 'isolated', 'lightbox_id32', 'filters', 'country_id', 'forward_to', 'content_ids', 'offset', 'order', 'thumbnail_size', 'limit', 'similia_id', 'media_id', 'detail_level', 'action', ); $this->type_of_stats = array( 'member_viewed_photos', 'member_downloaded_photos', 'member_bought_photos', 'member_earned_credits', ); $this->displayed_period = array( 'day', 'week', 'month', 'quarter', 'year', ); $this->easy_date_periods = array( 'all', 'today', 'yesterday', 'one_day', 'two_days', 'three_days', 'one_week', 'one_month', ); } /* * Prepare the xml rpc request and send to the servers * * @param string $method the method name * @param array $params the parameters to send in the xmlrpc request * @param optional string $session_id valid php session id returned by xmlrpc.loginUser method * @return $result * */ function request($method, $params, $session_id='') { //if ( is_array($params) && count($params)>0 ) { $xmlrpc_params = array(); // always send the api key as first parameter $xmlrpc_params[] = XMLRPC_prepare($this->api_key); if ($method == "xmlrpc.getSearchResults") { $xmlrpc_params[] = XMLRPC_prepare( $this->prepareSearch($params) ); } else { if ( is_array($params) && count($params) ) { foreach ( $params as $name => $value ){ // prepare each parameter for the xml rpc request $int_value = (int) $value; if ($value == $int_value) { $value = $int_value; } else { $float_value = (float) $value; if ($value == $float_value) { $value = $float_value; } } $xmlrpc_params[] = XMLRPC_prepare($value); } } } // send request to the server $result = XMLRPC_request ( $this->url, $this->path, array($method), $xmlrpc_params, $user_agent='', $session_id); $result = $result[1]; return $result; //} } /* * * Automatically prepare the search parameters for the xmlrpc request * Retrieves all possible search parameters from $this->search_params set in constructor * * @return $xmlrpc_params * */ function prepareSearch($params) { $xmlrpc_params = array(); foreach ($this->search_params as $value) { if ( isset($params[$value]) && $params[$value]<>'' ) { if ( is_array($params[$value]) ) { foreach ($params[$value] as $filterName => $filterValue) { $xmlrpc_params[$value][$filterName] = $filterValue; } } else { $xmlrpc_params[$value] = $params[$value]; } } elseif ( isset($this->forced_params[$value]) ) { $xmlrpc_params[$value] = $this->forced_params[$value]; } } /*if ( !isset($_REQUEST['offset']) ) { $xmlrpc_params['offset'] = (int)0; }*/ return $xmlrpc_params; } /* * * Automatically prepare the query string for the search pagination * Retrieves all possible search parameters from $this->search_params set in constructor * * @return $query_string * */ function buildSearchQueryString () { $query_string = ''; foreach ($this->search_params as $value) { if ( isset($_REQUEST[$value]) && $_REQUEST[$value]<>'' ) { if ( is_array($_REQUEST[$value]) ) { foreach ($_REQUEST[$value] as $filterName => $filterValue) { $query_string .= '&filters[' . htmlentities($filterName) . ']=' . htmlentities($filterValue); } } else { //As "offset" will change in the URL of pagination buttons, every other value is stored to be added later in the URL if ($value <> "offset") { $query_string .= '&' . htmlentities($value) . '=' . $_REQUEST[$value]; $xmlrpc_params[$value] = $_REQUEST[$value]; } } } elseif ( isset($this->forced_params[$value]) ) { $query_string .= '&' . htmlentities($filterName) . '=' . htmlentities($filterValue); } } return $query_string; } /* * * Automatically prepare the page number and links for navigation through results * * @return $pagination * */ function getSearchPagination($result) { $pagination = ''; $previous_link_qs = ''; $next_link_qs = ''; //If no offset is set in the $_REQUEST array then it takes the value of 0 if (!isset($_REQUEST['offset'])) { $offset = 0; } else { $offset = $_REQUEST['offset']; } if (isset($result['navigation_links'])) { $current_page_number = $result['navigation_links']['currentPageNumber']; $previous_link_qs = str_replace('/Xmlrpc/rpc?', '', $result['navigation_links']['previous']); // query string $next_link_qs = str_replace('/Xmlrpc/rpc?', '', $result['navigation_links']['next']); // query string } //The values in $_REQUEST are stored in this variable to be used later in links. $query_string = $this->buildSearchQueryString(); //The "Previous" button if ($previous_link_qs != NULL) { $pagination .= ''; } //Each page is then added to the list foreach ($result['navigation_links']['pagination'] as $page_number => $page_qs ) { if ($page_qs==''){ $pagination .= '...
>
> '; } else { $current_qs = str_replace('/Xmlrpc/rpc?', '', $page_qs). $query_string; //$current_qs = '&action=' . $_REQUEST['action'] . $query_string; $pagination .= '$value) { $esplode_url = explode ("=", $current_url[$key]); foreach ($esplode_url as $key2 => $value2) { if ($esplode_url[$key2] == "offset") { $current_offset = $esplode_url[$key2+1]; } } } if ($offset == $current_offset) { $pagination .= "pagination_current"; } else { $pagination .= "pagination"; } $pagination .= '">' .$page_number . ''; } } //The "Next" button if ($next_link_qs != NULL) { $pagination .= 'Next >>'; } return $pagination; } /*public function prepareStatistics() { }*/ } ?><< Previous- Skrýt citovaný text -

Olivier Sirven

unread,
May 9, 2008, 12:02:55 PM5/9/08
to Fotol...@googlegroups.com
Can you give me the request you are sending to the server?

am string $method the method name * @param array $params the parameters to send in the xmlrpc request * @param optional string $session_id valid php session id returned by xmlrpc.loginUser method * @return $result * */ function request($method, $params, $session_id='') { //if ( is_array($params)&& count($params)>0 ) { $xmlrpc_params = array(); // always send the api key as first parameter $xmlrpc_params[] = XMLRPC_prepare($this->api_key); if ($method == "xmlrpc.getSearchResults") { $xmlrpc_params[] = XMLRPC_prepare( $this->prepareSearch($params) ); } else { if ( is_array($params)&& count($params) ) { foreach ( $params as $name => $value ){ // prepare each parameter for the xml rpc request $int_value = (int) $value; if ($value == $int_value) { $value = $int_value; } else { $float_value = (float) $value; if ($value == $float_value) { $value = $float_value; } } $xmlrpc_params[] = XMLRPC_prepare($value); } } } // send request to the server $result = XMLRPC_request ( $this->url
, $this->path, array($method), $xmlrpc_params, $user_agent='', $session_id); $result = $result[1]; return $result; //} } /* * * Automatically prepare the search parameters for the xmlrpc request * Retrieves all possible search parameters from $this->search_params set in constructor * * @return $xmlrpc_params * */ function prepareSearch($params) { $xmlrpc_params = array(); foreach ($this->search_params as $value) { if ( isset($params[$value])&& $params[$value]<>'' ) { if ( is_array($params[$value]) ) { foreach ($params[$value] as $filterName => $filterValue) { $xmlrpc_params[$value][$filterName] = $filterValue; } } else { $xmlrpc_params[$value] = $params[$value]; } } elseif ( isset($this->forced_params[$value]) ) { $xmlrpc_params[$value] = $this->forced_params[$value]; } } /*if ( !isset($_REQUEST['offset']) ) { $xmlrpc_params['offset'] = (int)0; }*/ return $xmlrpc_params; } /* * * Automatically prepare the query string for the search pagination * Retrieves all possible searc
h parameters from $this->search_params set in constructor * * @return $query_string * */ function buildSearchQueryString () { $query_string = ''; foreach ($this->search_params as $value) { if ( isset($_REQUEST[$value])&& $_REQUEST[$value]<>'' ) { if ( is_array($_REQUEST[$value]) ) { foreach ($_REQUEST[$value] as $filterName => $filterValue) { $query_string .= '&filters[' . htmlentities($filterName) . ']=' . htmlentities($filterValue); } } else { //As "offset" will change in the URL of pagination buttons, every other value is stored to be added later in the URL if ($value<> "offset") { $query_string .= '&' . htmlentities($value) . '=' . $_REQUEST[$value]; $xmlrpc_params[$value] = $_REQUEST[$value]; } } } elseif ( isset($this->forced_params[$value]) ) { $query_string .= '&' . htmlentities($filterName) . '=' . htmlentities($filterValue); } } return $query_string; } /* * * Automatically prepare the page number and links for navigation through results * * @return $pagination *

*/ function getSearchPagination($result) { $pagination = ''; $previous_link_qs = ''; $next_link_qs = ''; //If no offset is set in the $_REQUEST array then it takes the value of 0 if (!isset($_REQUEST['offset'])) { $offset = 0; } else { $offset = $_REQUEST['offset']; } if (isset($result['navigation_links'])) { $current_page_number = $result['navigation_links']['currentPageNumber']; $previous_link_qs = str_replace('/Xmlrpc/rpc?', '', $result['navigation_links']['previous']); // query string $next_link_qs = str_replace('/Xmlrpc/rpc?', '', $result['navigation_links']['next']); // query string } //The values in $_REQUEST are stored in this variable to be used later in links. $query_string = $this->buildSearchQueryString(); //The "Previous" button if ($previous_link_qs != NULL) { $pagination .= ''; } //Each page is then added to the list foreach ($result['navigation_links']['pagination'] as $page_number => $page_qs ) { if ($page_qs==''){ $pagination .= '...
>>
>> '; } else { $current_qs = str_replace('/Xmlrpc/rpc?', '', $page_qs). $query_string; //$current_qs ='&action=' . $_REQUEST['action'] . $query_string; $pagination .= '$value) { $esplode_url = explode ("=", $current_url[$key]); foreach ($esplode_url as $key2 => $value2) { if ($esplode_url[$key2] == "offset") { $current_offset = $esplode_url[$key2+1]; } } } if ($offset == $current_offset) { $pagination .= "pagination_current"; } else { $pagination .= "pagination"; } $pagination .= '">' .$page_number . ''; } } //The "Next" button if ($next_link_qs != NULL) { $pagination .= 'Next>>'; } return $pagination; } /*public function prepareStatistics() { }*/ } ?><< Previous- Skrýt citovaný text -
>>
>> - Zobrazit citovaný text -
> >

--
Olivier

fernando rodriguez

unread,
May 9, 2008, 12:44:59 PM5/9/08
to fotol...@googlegroups.com
pueden hablarme en español por favor. gracias

Fernando Rodriguez
The Sign ltda
6330256 - 312 5875272
 
 
NOTA CONFIDENCIAL: La información contenida en este E-mail es confidencial
y solo puede ser utilizada por el individuo o la compañía a la cual este
dirigido. Si no es el receptor autorizado, debe advertir que cualquier
retención, difusión, distribución o copia de este mensaje es prohibida y
sancionada por la ley. Si por error recibe este mensaje, favor reenviar y
borrar el mensaje recibido y sus anexos inmediatamente.  CONFIDENTIALITY
NOTICE: This email, including attachments, is for the sole use of the
individual(s) or company to whom it is addressed, and may contain
confidential and privileged information. Any unauthorized review, use,
disclosure or distribution is prohibited. If you have received this email
in error, please notify the sender by reply email and destroy this message
and its attachments.




> Date: Fri, 9 May 2008 18:02:55 +0200
> From: oli...@fotolia.com
> To: Fotol...@googlegroups.com
> Subject: Re: get_media_data doesn't work

Moobys

unread,
May 9, 2008, 2:06:46 PM5/9/08
to Fotolia API
So this is the request that new fotolia_api_klient.php makes:

POST /Xmlrpc/rpc HTTP/1.0
Host: fr.fotolia.com
Connection: close
Content-Type: text/xml
Content-Length: 371

<?xml version="1.0" encoding="utf-8"?>
<methodCall>
<methodName>xmlrpc.loginUser</methodName>
<params>
<param>
<value>
<string>api_key</string>
</value>
</param>
<param>
<value>
<int>0</int>
</value>
</param>
<param>
<value>
<int>0</int>
</value>
</param>
</params>
</methodCall>


I've called it by classical old script like this:

include ('../xml-rpc.php');
include ('../config.php');
include ('../fotolia_api_client.php');


$api_client = new fotoliaApiClient($api_key, $url, $path);

$login_login="mylogin";
$heslo_login="mypassword";

$params = array('login'=> $login_login);
$params['pass'] = $heslo_login;


$result = $api_client->request('xmlrpc.loginUser', $params);



When I'm using old fotolia_api_client.php script, request is all right
and I logged succesfully, but with old script doesn't work
GetMediaData method and also GetData method.
Thank You
Moobys




On 9 Kvě, 18:44, fernando rodriguez <moscad...@hotmail.com> wrote:
> pueden hablarme en español por favor. graciasFernando RodriguezThe Sign ltda6330256 - 312 5875272  NOTA CONFIDENCIAL: La información contenida en este E-mail es confidencialy solo puede ser utilizada por el individuo o la compañía a la cual estedirigido. Si no es el receptor autorizado, debe advertir que cualquierretención, difusión, distribución o copia de este mensaje es prohibida ysancionada por la ley. Si por error recibe este mensaje, favor reenviar yborrar el mensaje recibido y sus anexos inmediatamente.  CONFIDENTIALITYNOTICE: This email, including attachments, is for the sole use of theindividual(s) or company to whom it is addressed, and may containconfidential and privileged information. Any unauthorized review, use,disclosure or distribution is prohibited. If you have received this emailin error, please notify the sender by reply email and destroy this messageand its attachments.
>
> > Date: Fri, 9 May 2008 18:02:55 +0200> From: oliv...@fotolia.com> To: Fotol...@googlegroups.com> Subject: Re: get_media_data doesn't work> > > Can you give me the request you are sending to the server?> > Moobys wrote:> > Thak You,> > i'm using it, GetMediaData it works now,> > but the the LoginUser method doesn't work now, error 623 again.> >> > Please fix it as soon as possible, we cannot order photos from> > Fotolia, our webshop is out of order.> > Thank You very much.> >> > Moobys> >> > On 9 Kvě, 11:48, Olivier Sirven<oliv...@fotolia.com> wrote:> >> Hi Moobys,> >>> >> It's because the second parameter should be an integer (not a string).> >> There is a bug into fotolia_api_client.php of the php4 kit. So if you> >> are using it, please replace fotolia_api_client.php file with the> >> attached one.> >>> >> Olivier> >>> >>> >>> >> Moobys wrote:> >>> Hello, this is the request and a response. api_key is all right, I've> >>> checked it.> >>> POST /Xmlrpc/rpc HTTP/1.0> >>> Host: fr.fotolia.com> >>> Connection: close> >>> Content-Type: text/xml> >>> Content-Length: 947> >>> <?xml version="1.0" encoding="utf-8"?>> >>> <methodCall>> >>> <methodName>xmlrpc.getMediaData</methodName>> >>> <params>> >>> <param>> >>> <value>> >>> <struct>> >>> <member>> >>> <name>api_key</name>> >>> <value>> >>> <string>our api key</string>> >>> </value>> >>> </member>> >>> </struct>> >>> </value>> >>> </param>> >>> <param>> >>> <value>> >>> <struct>> >>> <member>> >>> <name>id</name>> >>> <value>> >>> <string>180699</string>> >>> </value>> >>> </member>> >>> </struct>> >>> </value>> >>> </param>> >>> <param>> >>> <value>> >>> <struct>> >>> <member>> >>> <name>thumbnail_size</name>> >>> <value>> >>> <int>110</int>> >>> </value>> >>> </member>> >>> </struct>> >>> </value>> >>> </param>> >>> <param>> >>> <value>> >>> <struct>> >>> <member>> >>> <name>language_id</name>> >>> <value>> >>> <int>2</int>> >>> </value>> >>> </member>> >>> </struct>> >>> </value>> >>> </param>> >>> </params>> >>> </methodCall>> >>> Received the following response:> >>> HTTP/1.1 200 OK> >>> Date: Thu, 08 May 2008 11:52:28 GMT> >>> Server: Apache> >>> X-Powered-By: PHP/5.2.5> >>> Set-Cookie: PHPSESSID=deleted; expires=Wed, 09-May-2007 11:52:27 GMT;> >>> path=/; domain=download.fotolia.com> >>> Set-Cookie: PHPSESSID=416e2241527955e00c857076065f0be3; path=/;> >>> domain=.fotolia.com> >>> Expires: Thu, 19 Nov 1981 08:52:00 GMT> >>> Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-> >>> check=0> >>> Pragma: no-cache> >>> Content-Length: 307> >>> Connection: close> >>> Content-Type: text/xml> >>> <?xml version="1.0" encoding="ISO-8859-1"?>> >>> <methodResponse><fault><value><struct><member><name>faultCode</> >>> name><value><int>623</int></value></member><member><name>faultString</> >>> name><value><string>Calling parameters do not match signature</> >>> string></value></member></struct></value></fault></methodResponse>> >>> >>> >> [fotolia_api_client.php]> >> parameters set in the page like getSearchResults with serie_id set. var $forced_params; function fotoliaApiClient($api_key, $url, $path) { $this->api_key = $api_key; $this->url = $url; $this->path = $path; $this->search_params = array( 'keywords', 'words', 'language_id', 'color_name', 'creator_id', 'k', 'serie_id', 'model_id', 'similar_id', 'cat1_id', 'cat2_id', 'gallery_id', 'category_ids', 'isolated', 'lightbox_id32', 'filters', 'country_id', 'forward_to', 'content_ids', 'offset', 'order', 'thumbnail_size', 'limit', 'similia_id', 'media_id', 'detail_level', 'action', ); $this->type_of_stats = array( 'member_viewed_photos', 'member_downloaded_photos', 'member_bought_photos', 'member_earned_credits', ); $this->displayed_period = array( 'day', 'week', 'month', 'quarter', 'year', ); $this->easy_date_periods = array( 'all', 'today', 'yesterday', 'one_day', 'two_days', 'three_days', 'one_week', 'one_month', ); } /* * Prepare the xml rpc request and send to the servers * * @par> am string $method the method name * @param array $params the parameters to send in the xmlrpc request * @param optional string $session_id valid php session id returned by xmlrpc.loginUser method * @return $result * */ function request($method, $params, $session_id='') { //if ( is_array($params)&& count($params)>0 ) { $xmlrpc_params = array(); // always send the api key as first parameter $xmlrpc_params[] = XMLRPC_prepare($this->api_key); if ($method == "xmlrpc.getSearchResults") { $xmlrpc_params[] = XMLRPC_prepare( $this->prepareSearch($params) ); } else { if ( is_array($params)&& count($params) ) { foreach ( $params as $name => $value ){ // prepare each parameter for the xml rpc request $int_value = (int) $value; if ($value == $int_value) { $value = $int_value; } else { $float_value = (float) $value; if ($value == $float_value) { $value = $float_value; } } $xmlrpc_params[] = XMLRPC_prepare($value); } } } // send request to the server $result = XMLRPC_request ( $this->url> , $this->path, array($method), $xmlrpc_params, $user_agent='', $session_id); $result = $result[1]; return $result; //} } /* * * Automatically prepare the search parameters for the xmlrpc request * Retrieves all possible search parameters from $this->search_params set in constructor * * @return $xmlrpc_params * */ function prepareSearch($params) { $xmlrpc_params = array(); foreach ($this->search_params as $value) { if ( isset($params[$value])&& $params[$value]<>'' ) { if ( is_array($params[$value]) ) { foreach ($params[$value] as $filterName => $filterValue) { $xmlrpc_params[$value][$filterName] = $filterValue; } } else { $xmlrpc_params[$value] = $params[$value]; } } elseif ( isset($this->forced_params[$value]) ) { $xmlrpc_params[$value] = $this->forced_params[$value]; } } /*if ( !isset($_REQUEST['offset']) ) { $xmlrpc_params['offset'] = (int)0; }*/ return $xmlrpc_params; } /* * * Automatically prepare the query string for the search pagination * Retrieves all possible searc> h parameters from $this->search_params set in constructor * * @return $query_string * */ function buildSearchQueryString () { $query_string = ''; foreach ($this->search_params as $value) { if ( isset($_REQUEST[$value])&& $_REQUEST[$value]<>'' ) { if ( is_array($_REQUEST[$value]) ) { foreach ($_REQUEST[$value] as $filterName => $filterValue) { $query_string .= '&filters[' . htmlentities($filterName) . ']=' . htmlentities($filterValue); } } else { //As "offset" will change in the URL of pagination buttons, every other value is stored to be added later in the URL if ($value<> "offset") { $query_string .= '&' . htmlentities($value) . '=' . $_REQUEST[$value]; $xmlrpc_params[$value] = $_REQUEST[$value]; } } } elseif ( isset($this->forced_params[$value]) ) { $query_string .= '&' . htmlentities($filterName) . '=' . htmlentities($filterValue); } } return $query_string; } /* * * Automatically prepare the page number and links for navigation through results * * @return $pagination * > */ function getSearchPagination($result) { $pagination = ''; $previous_link_qs = ''; $next_link_qs = ''; //If no offset is set in the $_REQUEST array then it takes the value of 0 if (!isset($_REQUEST['offset'])) { $offset = 0; } else { $offset = $_REQUEST['offset']; } if (isset($result['navigation_links'])) { $current_page_number = $result['navigation_links']['currentPageNumber']; $previous_link_qs = str_replace('/Xmlrpc/rpc?', '', $result['navigation_links']['previous']); // query string $next_link_qs = str_replace('/Xmlrpc/rpc?', '', $result['navigation_links']['next']); // query string } //The values in $_REQUEST are stored in this variable to be used later in links. $query_string = $this->buildSearchQueryString(); //The "Previous" button if ($previous_link_qs != NULL) { $pagination .= ''; } //Each page is then added to the list foreach ($result['navigation_links']['pagination'] as $page_number => $page_qs ) { if ($page_qs==''){ $pagination .= '...> >>> >> '; } else { $current_qs = str_replace('/Xmlrpc/rpc?', '', $page_qs). $query_string; //$current_qs ='&action=' . $_REQUEST['action'] . $query_string; $pagination .= '$value) { $esplode_url = explode ("=", $current_url[$key]); foreach ($esplode_url as $key2 => $value2) { if ($esplode_url[$key2] == "offset") { $current_offset = $esplode_url[$key2+1]; } } } if ($offset == $current_offset) { $pagination .= "pagination_current"; } else { $pagination .= "pagination"; } $pagination .= '">' .$page_number . ''; } } //The "Next" button if ($next_link_qs != NULL) { $pagination .= 'Next>>'; } return $pagination; } /*public function prepareStatistics() { }*/ } ?><< Previous- Skrýt citovaný text -> >>> >> - Zobrazit citovaný text -> > >> > -- > Olivier> > _________________________________________________________________
>
> Blog your life in 3D with Windows Live Writer.http://www.windowslive.com/overview.html?ocid=TXT_TAGLM_Wave2_wl_writ...

Moobys

unread,
May 9, 2008, 2:08:55 PM5/9/08
to Fotolia API
sorry
GetMediaData and GetMedia method doesn't work, it was a typing
mistake :)

Olivier Sirven

unread,
May 9, 2008, 3:15:28 PM5/9/08
to Fotol...@googlegroups.com
Try with this one, this should work

--
Olivier

fotolia_api_client.php

Moobys

unread,
May 12, 2008, 5:58:37 AM5/12/08
to Fotolia API
Thank You,
this works :)
Moo
> ...
>
> číst dál »
>
> [fotolia_api_client.php]
> parameters set in the page like getSearchResults with serie_id set. var $forced_params; function fotoliaApiClient($api_key, $url, $path) { $this->api_key = $api_key; $this->url = $url; $this->path = $path; $this->search_params = array( 'keywords', 'words', 'language_id', 'color_name', 'creator_id', 'k', 'serie_id', 'model_id', 'similar_id', 'cat1_id', 'cat2_id', 'gallery_id', 'category_ids', 'isolated', 'lightbox_id32', 'filters', 'country_id', 'forward_to', 'content_ids', 'offset', 'order', 'thumbnail_size', 'limit', 'similia_id', 'media_id', 'detail_level', 'action', ); $this->type_of_stats = array( 'member_viewed_photos', 'member_downloaded_photos', 'member_bought_photos', 'member_earned_credits', ); $this->displayed_period = array( 'day', 'week', 'month', 'quarter', 'year', ); $this->easy_date_periods = array( 'all', 'today', 'yesterday', 'one_day', 'two_days', 'three_days', 'one_week', 'one_month', ); } /* * Prepare the xml rpc request and send to the servers * * @param string $method the method name * @param array $params the parameters to send in the xmlrpc request * @param optional string $session_id valid php session id returned by xmlrpc.loginUser method * @return $result * */ function request($method, $params, $session_id='') { //if ( is_array($params) && count($params)>0 ) { $xmlrpc_params = array(); // always send the api key as first parameter $xmlrpc_params[] = XMLRPC_prepare($this->api_key); if ($method == "xmlrpc.getSearchResults") { $xmlrpc_params[] = XMLRPC_prepare( $this->prepareSearch($params) ); } else { if ( is_array($params) && count($params) ) { foreach ( $params as $name => $value ){ // prepare each parameter for the xml rpc request $int_value = intval($value); if ($value == strval($int_value)) { $value = $int_value; } else { $float_value = floatval($value); if ($value == strval($float_value)) { $value = $float_value; } } $xmlrpc_params[] = XMLRPC_prepare($value); } } } // send request to the server $result = XMLRPC_request ( $this->url, $this->path, array($method), $xmlrpc_params, $user_agent='', $session_id); $result = $result[1]; return $result; //} } /* * * Automatically prepare the search parameters for the xmlrpc request * Retrieves all possible search parameters from $this->search_params set in constructor * * @return $xmlrpc_params * */ function prepareSearch($params) { $xmlrpc_params = array(); foreach ($this->search_params as $value) { if ( isset($params[$value]) && $params[$value]<>'' ) { if ( is_array($params[$value]) ) { foreach ($params[$value] as $filterName => $filterValue) { $xmlrpc_params[$value][$filterName] = $filterValue; } } else { $xmlrpc_params[$value] = $params[$value]; } } elseif ( isset($this->forced_params[$value]) ) { $xmlrpc_params[$value] = $this->forced_params[$value]; } } /*if ( !isset($_REQUEST['offset']) ) { $xmlrpc_params['offset'] = (int)0; }*/ return $xmlrpc_params; } /* * * Automatically prepare the query string for the search pagination * Retrieves all possible search parameters from $this->search_params set in constructor * * @return $query_string * */ function buildSearchQueryString () { $query_string = ''; foreach ($this->search_params as $value) { if ( isset($_REQUEST[$value]) && $_REQUEST[$value]<>'' ) { if ( is_array($_REQUEST[$value]) ) { foreach ($_REQUEST[$value] as $filterName => $filterValue) { $query_string .= '&filters[' . htmlentities($filterName) . ']=' . htmlentities($filterValue); } } else { //As "offset" will change in the URL of pagination buttons, every other value is stored to be added later in the URL if ($value <> "offset") { $query_string .= '&' . htmlentities($value) . '=' . $_REQUEST[$value]; $xmlrpc_params[$value] = $_REQUEST[$value]; } } } elseif ( isset($this->forced_params[$value]) ) { $query_string .= '&' . htmlentities($filterName) . '=' . htmlentities($filterValue); } } return $query_string; } /* * * Automatically prepare the page number and links for navigation through results * * @return $pagination * */ function getSearchPagination($result) { $pagination = ''; $previous_link_qs = ''; $next_link_qs = ''; //If no offset is set in the $_REQUEST array then it takes the value of 0 if (!isset($_REQUEST['offset'])) { $offset = 0; } else { $offset = $_REQUEST['offset']; } if (isset($result['navigation_links'])) { $current_page_number = $result['navigation_links']['currentPageNumber']; $previous_link_qs = str_replace('/Xmlrpc/rpc?', '', $result['navigation_links']['previous']); // query string $next_link_qs = str_replace('/Xmlrpc/rpc?', '', $result['navigation_links']['next']); // query string } //The values in $_REQUEST are stored in this variable to be used later in links. $query_string = $this->buildSearchQueryString(); //The "Previous" button if ($previous_link_qs != NULL) { $pagination .= ''; } //Each page is then added to the list foreach ($result['navigation_links']['pagination'] as $page_number => $page_qs ) { if ($page_qs==''){ $pagination .= '...
Reply all
Reply to author
Forward
0 new messages