简体   繁体   English

如何在 php 中向 eBay Restful API 发出 GET cURL 请求

[英]How to make a GET cURL request to eBay Restful API in php

I'm having trouble getting a Restful GET cURL to the Ebay API, the code I'm using is below, could someone tell me what I'm doing wrong.我在获取 Ebay API 的 Restful GET cURL 时遇到问题,我正在使用的代码如下,有人可以告诉我我做错了什么。 Since some of the XML API Calls are being deprecated, I'd like to just design my code now to use the new Restful API's.由于某些 XML API 调用已被弃用,我现在只想设计我的代码以使用新的 Restful API。

$headers = array
(
    'Authorization: Bearer '.$oAuth
);

$queryString = '?category_id=213';
$url = 'https://api.sandbox.ebay.com/commerce/taxonomy/v1/category_tree/64482/get_item_aspects_for_category';

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, $url.$queryString);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 3);
$response = curl_exec($ch);
curl_close($ch);

print_r($response);

I'm pretty sure I figured out what the problem is, I finally got an error message out of the response and it says: "SSL certificate problem: unable to get local issuer certificate".我很确定我找到了问题所在,我终于从响应中得到了一条错误消息,上面写着:“SSL 证书问题:无法获得本地颁发者证书”。 I suppose the curl operation must come from a secure location before eBay will send the information in the request.我想 curl 操作必须来自安全位置,然后 eBay 才会发送请求中的信息。

If anyone else has any other ideas, please let me know.如果其他人有任何其他想法,请告诉我。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM