Quantcast
Channel: iT邦幫忙
Viewing all articles
Browse latest Browse all 15645

ebay api 的問題

$
0
0
俺的朋友有給俺一個JS的ebay api,不過俺測試不成功,一直沒有回傳.
可以請各位大大們給予小弟指導一下嗎??
俺JS比較差~~!Orz
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>ebay api test</title><link rel="stylesheet" type="text/css" href="css/skeleton.css" /><script type="text/javascript" src="js/jquery.min.js"></script><script type="text/javascript" src="js/jquery-ui-1.8.16.custom.min.js"></script></head><body><div style="text-align:center;margin-top:30px"><form name="form_sort" method="post"><input type='button' value='ebay api' onclick="ebayapi()" /></form></div><script language="JavaScript">
function ebayapi(){
var xml_1 = '&lt;?xml version="1.0" encoding="UTF-8"?&gt;';
xml_1 += '<GetItemTransactionsRequest xmlns="urn:ebay:apis:eBLBaseComponents"><ItemID>321072879984</ItemID>'+'<RequesterCredentials>'+'<eBayAuthToken>AgAAA....</eBayAuthToken>'+'</RequesterCredentials>'+'<WarningLevel>High</WarningLevel>'+'</GetItemTransactionsRequest>';
console.log('ebay-xml:'+xml_1);
/***call ebay start ***********/			
// Mozilla/Safari
if (window.XMLHttpRequest) {
xmlHttpReq = new XMLHttpRequest();
}
// IE
else if (window.ActiveXObject) {
xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlHttpReq.open('POST', 'https://api.sandbox.ebay.com/ws/api.dll', true);
//Set the Headers
xmlHttpReq.setRequestHeader('Content-Type','text/xml');
xmlHttpReq.setRequestHeader('X-EBAY-API-COMPATIBILITY-LEVEL','805');
xmlHttpReq.setRequestHeader('X-EBAY-API-DEV-NAME','e....');
xmlHttpReq.setRequestHeader('X-EBAY-API-APP-NAME','ed21...');
xmlHttpReq.setRequestHeader('X-EBAY-API-CERT-NAME','0c...');
xmlHttpReq.setRequestHeader('X-EBAY-API-CALL-NAME','GetItemTransactions');
xmlHttpReq.setRequestHeader('X-EBAY-API-SITEID','0');
//get the XML Request string
xmlHttpReq.send(xml_1);
//When the response is available, update the response text
xmlHttpReq.onreadystatechange = function() {
console.log('ebay-readyState:'+xmlHttpReq.readyState);
if (xmlHttpReq.readyState == 4) {
console.log('ebay-response:'+xmlHttpReq.responseText);
}
}
/***call ebay end ***********/	
return false;
}</script></body></html>

麻煩各位大大 大神們幫忙了

Viewing all articles
Browse latest Browse all 15645

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>