public function get_item() { $item_id = $this->input->post('item_id'); $site = $this->input->post('site'); $this->ebay_config['siteToUseID'] = get_site_id($site); $this->ebay_config['callName'] = 'GetItem'; $this->load->library('ebayapi/EbaySession', $this->ebay_config); $xml = get_item($this->appToken, $item_id); $resp = $this->xmlRequest($this->ebaysession, $xml); $data = item_to_array($resp); echo json_encode($data); }
function peopleaggregator_getItems($args) { global $_PA; require_once PA::$path . "/api/Item/Item.php"; $remote_user = @$args['remoteUser']; if ($remote_user) { if (!$_PA->enable_widgetization_server) { throw new PAException(OPERATION_NOT_PERMITTED, "Widgetization disabled; you cannot use remote user functions"); } require_once PA::$path . "/api/User/ShadowUser.php"; require_once PA::$path . "/api/Rating/Rating.php"; require_once PA::$path . "/ext/PA_Rating/PA_Rating.php"; $remote_id = explode(":", $remote_user); if (count($remote_id) == 1) { throw new PAException(INVALID_ID, "Remote user IDs must be of the form 'namespace:id'"); } $u = new ShadowUser($remote_id[0]); $u->load($remote_id[1]); if (!$u->user_id) { throw new PAException(USER_NOT_FOUND, "Failed to locate user '" . $remote_id[1] . "' in namespace '" . $remote_id[0] . "'"); } } else { $u = NULL; } $items_out = array(); foreach (explode(",", $args['ids']) as $packed_id) { $item_id = explode(":", $packed_id); if (count($item_id) == 1) { throw new PAException(INVALID_ID, "Individual item IDs must be of the form 'type:id'"); } $item = Item::find_by_subject($item_id[0], $item_id[1]); if ($item == NULL) { continue; } // ignore IDs that don't exist $item_out = item_to_array($item); if ($u) { $params = array('rating_type' => $item_id[0], 'user_id' => $u->user_id, 'type_id' => $item_id[1]); $user_rating_details = PA_Rating::get($params); if (count($user_rating_details)) { $item_out['userRating'] = (int) $user_rating_details[0]->rating; } } $items_out[] = $item_out; } return array("success" => TRUE, "msg" => "Retrieved " . count($items_out) . " item(s)", "items" => $items_out); }