question

gn-mike avatar image
0 Likes"
gn-mike asked

Randomize results from GetFeedback

I'm currently pulling Feedback into my website as testimonials. It seems to work well but I have an issue with it loading the same feedback in the same order every time. Is there anyway to randomize the XML output so that the testimonials load differently each time? Also, is it possible to sort by age? For example, load newest to oldest? My code is below:

$headers = array
(
'X-EBAY-API-SITEID:0',
'X-EBAY-API-COMPATIBILITY-LEVEL:967',
'X-EBAY-API-CALL-NAME:GetFeedback'   
);
 
// Generate XML request
$xml_request = '
<?xml version="1.0" encoding="utf-8"?>
<GetFeedbackRequest xmlns="urn:ebay:apis:eBLBaseComponents">
  <RequesterCredentials>
    <eBayAuthToken>*****</eBayAuthToken>
  </RequesterCredentials>
<ErrorLanguage>en_US</ErrorLanguage>
<WarningLevel>High</WarningLevel>
      <!-- Enter the eBay User ID for whom you want feedback-->
  <UserID>gunnookstore</UserID>
  <DetailLevel>ReturnAll</DetailLevel>
  <Pagination>
    <EntriesPerPage>200</EntriesPerPage>
  </Pagination>
</GetFeedbackRequest>
';
 
// Send request to eBay and load response in $response
$connection = curl_init();
curl_setopt($connection, CURLOPT_URL, "https://api.ebay.com/ws/api.dll?");
curl_setopt($connection, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($connection, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($connection, CURLOPT_HTTPHEADER, $headers);
curl_setopt($connection, CURLOPT_POST, 1);
curl_setopt($connection, CURLOPT_POSTFIELDS, $xml_request);
curl_setopt($connection, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($connection);
curl_close($connection);
// Load the call and capture the document returned by eBay API
$resp = simplexml_load_string($response);

$objJsonDocument = json_encode($resp);
$arrOutput = json_decode($objJsonDocument, TRUE);


feedback-apisorting
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

0 Answers

· Write an Answer

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.