我正在使用库连接到我的 ETSY 商店并从收据中提取数据以将它们带入我的个人网站(数据库)。
使用 OAuth 发出请求后,我进入 ETSY 站点以“允许访问”
https://www.etsy.com/images/apps/documentation/oauth_authorize.png
然后,我需要手动单击允许访问,我的请求将完成并显示请求的数据。
我想避免手动单击“允许访问”的过程,因为我希望我的个人网站自动显示从 ETSY 订单中提取的信息。
这是我当前页面 etsyRequest.php 的代码:
$credentials = new Credentials(
$servicesCredentials['etsy']['key'],
$servicesCredentials['etsy']['secret'],
$currentUri->getAbsoluteUri()
);
// Instantiate the Etsy service using the credentials, http client and storage mechanism for the token
/** @var $etsyService Etsy */
$etsyService = $serviceFactory->createService('Etsy', $credentials, $storage);
if (!empty($_GET['oauth_token'])) {
$token = $storage->retrieveAccessToken('Etsy');
// This was a callback request from Etsy, get the token
$etsyService->requestAccessToken(
$_GET['oauth_token'],
$_GET['oauth_verifier'],
$token->getRequestTokenSecret()
);
// Send a request now that we have access token
$result2 = json_decode($etsyService->request('/receipts/111111'));
//echo 'result: <pre>' . print_r($result, true) . '</pre>';
echo $result2->results[0]->seller_user_id;
如何仅通过运行此页面来自动化 Allow Access 部分并获取我的请求的返回值?