eBayのShoppingAPIを使用しようとしているようです。具体的には、FindItemsAdvanced
かなり前に廃止され、機能しなくなった可能性があると思われる呼び出しです(呼び出し参照には表示されなくなりました)。あなたがしたいのはfindItemsAdvanced
、eBayのFindingAPIからの使用を使用することです。
まず、APIエンドポイントとクエリ文字列パラメータを少し変更する必要があります(詳細については前述の呼び出しリファレンスを参照してくださいが、これはもっと似ていると思います(少なくとも6か月間呼び出しにfindItemsAdvanced
触れていません)findItemsAdvanced
、だから私はこれをテストしていません):
$endpoint = 'http://svcs.ebay.com/services/search/FindingService/v1?';
$responseEncoding = 'XML';
$version = '1.8.0'; // API version number (they're actually up to 1.11.0 at this point
$appID = 'asdf3e6e3';
$itemSort = "EndTimeSoonest";
//find items advanced
$apicalla = "$endpoint"
."OPERATION-NAME=findItemsAdvanced"
."&SERVICE-VERSION=$version"
."&GLOBAL-ID=EBAY-US"
."&SECURITY-APPNAME=$appID"
//."&MaxEntries=10" // look for an equivalent for this (maybe paginationInput.entriesPerPage?)
."&sortOrder=EndTimeSoonest"
//."&ItemType=AllItemTypes" // not needed AFAICT, otherwise look at itemFilterType
."&descriptionSearch=true";
."& RESPONSE-DATA-FORMAT=$responseEncoding";
$resp = simplexml_load_file($apicalla);
これに加えて、を使用するfindItemsAdvanced
には、検索対象をカテゴリ(categoryId
)またはキーワード(keywords
)のいずれかで指定する必要があるため、「クエリを指定してください!」エラーメッセージ。
したがって、次のようなものも追加する必要があります(キーワードを想定)。
$keywords = "something";
$apicalla .= "&keywords=" . urlencode($keywords);
あなたに以下を与える:
$endpoint = 'http://svcs.ebay.com/services/search/FindingService/v1?';
$responseEncoding = 'XML';
$version = '1.8.0'; // API version number (they're actually up to 1.11.0 at this point
$appID = 'asdf3e6e3';
$itemSort = "EndTimeSoonest";
$keywords = "something"; // make sure this is a valid keyword or keywords
//find items advanced
$apicalla = "$endpoint"
."OPERATION-NAME=findItemsAdvanced"
."&SERVICE-VERSION=$version"
."&GLOBAL-ID=EBAY-US"
."&SECURITY-APPNAME=$appID"
//."&MaxEntries=10" // look for an equivalent for this (maybe paginationInput.entriesPerPage?)
."&sortOrder=$itemSort"
//."&ItemType=AllItemTypes" // not needed AFAICT, otherwise look at itemFilterType
."&descriptionSearch=true";
."& RESPONSE-DATA-FORMAT=$responseEncoding"
."&keywords=" . urlencode($keywords);
$resp = simplexml_load_file($apicalla);
最後の注意:結果で見つかった特定のアイテムの詳細をロードする場合でも、Shopping API(具体的にはGetSingleItemおよびGetMultipleItems呼び出し)を使用する必要があります。したがって、最終的にはショッピングAPIと検索APIを組み合わせて使用できます。