2
非常具體的問題,但我會盡我所能將其排除。嘗試在TradeGecko API中添加新訂單時發生500錯誤
我可以很容易地向TradeGecko API(詳細在這裏:http://developer.tradegecko.com/)發出POST請求並獲得不同的價格作爲回報,這部分交互工作正常。
但是,我試圖創建一個新的訂單,我覺得我失去了一些東西!
這是我有:
<?php
$authorizeUrl = 'https://api.tradegecko.com/oauth/authorize';
$accessTokenUrl = 'https://api.tradegecko.com/oauth/token';
$clientId = <MY_CLIENT_ID>;
$clientSecret = <MY_CLIENT_SECRET>;
$redirectUrl = <REDIRECT_URI>;
// https://github.com/adoy/PHP-OAuth2
require("Client.php");
require("GrantType/IGrantType.php");
require("GrantType/AuthorizationCode.php");
$client = new OAuth2\Client($clientId, $clientSecret, OAuth2\Client::AUTH_TYPE_AUTHORIZATION_BASIC);
$client->setCurlOption(CURLOPT_USERAGENT,$userAgent);
$client->setAccessToken(<MY_ACCESS_TOKEN>);
$client->setAccessTokenType(OAuth2\Client::ACCESS_TOKEN_BEARER);
$params =
array('order' =>
array(
'company_id' => '12345',
'shipping_address_id' => 1,
'billing_address_id' => 1,
'status' => 'active',
'issued_at' => '10-04-2016',
'order_line_items' => array(
array('variant_id' => 123456,
'quantity' => 2),
array('variant_id' => 123457,
'quantity' => 2)
)
)
);
$response = $client->fetch('https://api.tradegecko.com/orders', false, $params);
print_r($response);
?>
我希望有什麼東西在該代碼,別人可能會看到,我在它的眼前了6個小時的大部分時間,現在,我不知道爲什麼這不會通過。