|
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 <nameid</name <value <string180699</string </value </member </struct </value </param should be <param <value <struct <member <nameid</name <value <int180699</ int </value </member </struct </value </param [ 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 _xml_rpc request * @param optional string $session_id valid php session id returned by _xml_rpc.loginUser method * @return $result * */ function request($method, $params, $session_id='') { //if ( is_array($params) && count($params)0 ) { $_xml_rpc_params = array(); // always send the api key as first parameter $_xml_rpc_params[] = _xml_RPC_prepare($this-api_key); if ($method == "_xml_rpc.getSearchResults") { $_xml_rpc_params[] = _xml_RPC_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; } } $_xml_rpc_params[] = _xml_RPC_prepare($value); } } } // send request to the server $result = _xml_RPC_request ( $this-url, $this-path, array($method), $_xml_rpc_params, $user_agent='', $session_id); $result = $result[1]; return $result; //} } /* * * Automatically prepare the search parameters for the _xml_rpc request * Retrieves all possible search parameters from $this-search_params set in constructor * * @return $_xml_rpc_params * */ function prepareSearch($params) { $_xml_rpc_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) { $_xml_rpc_params[$value][$filterName] = $filterValue; } } else { $_xml_rpc_params[$value] = $params[$value]; } } elseif ( isset($this-forced_params[$value]) ) { $_xml_rpc_params[$value] = $this-forced_params[$value]; } } /*if ( !isset($_REQUEST['offset']) ) { $_xml_rpc_params['offset'] = (int)0; }*/ return $_xml_rpc_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]; $_xml_rpc_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 _link_s 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__link_s'])) { $current_page_number = $result['navigation__link_s']['currentPageNumber']; $previous__link__qs = str_replace('/_xml_rpc/rpc?', '', $result['navigation__link_s']['previous']); // query string $next__link__qs = str_replace('/_xml_rpc/rpc?', '', $result['navigation__link_s']['next']); // query string } //The values in $_REQUEST are stored in this variable to be used later in _link_s. $query_string = $this-buildSearchQueryString(); //The "Previous" button if ($previous__link__qs != NULL) { $pagination .= '« Previous'; } //Each page is then added to the list foreach ($result['navigation__link_s']['pagination'] as $page_number = $page_qs ) { if ($page_qs==''){ $pagination .= ' ... '; } else { $current_qs = str_replace('/_xml_rpc/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() { }*/ } ?
|