I am trying to use the Ally Invest/ Tradeking PHP API to request a market quote: https://www.ally.com/api/invest/documentation/market-ext-quotes-get-post/
Using the documentation, I installed PHP OAuth and I created the below code, but it doesnt seem to yield an output when i make the call:
$consumer_key = 'Z3fPyf181adB63Gq4gQZAjL1b7xgx7jLGA92DQ9jnuk4';
$consumer_secret = 'feDtEmHTWoRb4rDMZkF6gvXj0xd2lP5vGDXPCUiZJww7';
$access_token = '251cgNlYK21b6tqbqYSImAiqJKk3c51lHu4UOOF71ZI4';
$access_secret = 'aLth5Imx0VgB67IgFhDxmW3QVYKPxdtzNMmjbiNWYXI7';
$oauth = new OAuth($consumer_key,$consumer_secret,OAUTH_SIG_METHOD_HMACSHA1,OAUTH_AUTH_TYPE_AUTHORIZATION);
$oauth->setToken($access_token,$access_secret);
$noonce=date('U') ;
$oauth->setNonce($noonce);
$signature= $oauth->generateSignature("GET", "https://api.tradeking.com/v1/market/ext/quotes.xml?symbols=fb");
$url = 'https://api.tradeking.com/v1/market/ext/quotes.xml?symbols=fb';
$header = [
"GET /v1/market/ext/quotes.xml?symbols=fb HTTP/1.1
" .
"Authorization: OAuth
" .
'oauth_consumer_key="'.$consumer_key.'"' . "
" .
'oauth_nonce="'.$noonce.'"' . "
" .
'oauth_signature="'.$signature.'"' . "
" .
'oauth_signature_method="HMAC-SHA1"' . "
" .
'oauth_timestamp="'.time().'"' . "
" .
'oauth_token="'.$access_token.'"' . "
" .
'oauth_version="1.0"' . "
" .
'Connection: close' . "
" .
'Host: api.tradeking.com'
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER,$header);
$response = curl_exec($ch);