I'm a somewhat novice developer and I built a small page on my site in PHP using some of the old templates that eBay had provided a while back. I'm now struggling to switch to the Browse API. I'm wondering if anyone has built a template with strings in PHP that shows what to use for headers specifically and a breakdown of variables using the search request in the Browse API.
Previously I had something like this but there are a few things I'm struggling with. Mostly the Oauth part---and the headers required for the Browse API. How would I implement them in code like this? I don't see any reference anywhere on how to do this. It looks like i need a new Oauth token, that expires every 18 months--is this correct? Would i just need to revisit, regenerate and replace the token on each page i use this?
// API request variables $endpoint = 'https://api.ebay.com/buy/browse/v1/item_summary/search?'; // URL to call //$version = '1.0.0'; // API version supported by your application $appid = 'xx'; // Replace with your own AppID $globalid = 'EBAY-US'; // Global ID of the eBay site you want to search (e.g., EBAY-DE) $query = 'xx'; // You may want to supply your own query $safequery = urlencode($query); // Make the query URL-friendly // Construct the findItemsByKeywords HTTP GET call $apicall = "$endpoint?"; //$apicall .= "OPERATION-NAME=findItemsAdvanced"; $apicall .= "&SERVICE-VERSION=$version"; $apicall .= "&SECURITY-APPNAME=$appid"; $apicall .= "&GLOBAL-ID=$globalid"; $apicall .= "&q=$safequery"; $apicall .= "&affiliate.trackingId=xx"; $apicall .= "&affiliate.networkId=9"; $apicall .= "&affiliate.customId=xx"; $apicall .= "&paginationInput.entriesPerPage=30"; //$apicall .= "&sortOrder=WatchCountDecreaseSort"; $apicall .= "$urlfilter";