Hello- Can anyone provide some insight into how to properly parse the system(curl) response into matlab.
It is currently returned into a string field, but I need to get the individual name/value pairs as variables.
No doubt there is a better way to make this request using webread, but I have been unsuccessful in formatting the headers properly, so have been using curl.
The objective is to pull these two pairs and save them as seperate variables in matlab
"access_token" : "n0f9jeyyc"
"expires_in" : 1800
The system(curl) request (with token abbreviated)
>>>>>>>
command = 'curl -X POST --header "Content-Type: application/x-www-form-urlencoded" -d "grant_type=refresh_token&refresh_token=uc80SIH3400B75E&access_type=&code=&client_id=CPUNQFIRUX1FHKWW8XJO7DMZWRCRQGMU%40AMER.OAUTHAP&redirect_uri=http%3A%2F%2Flocalhost" "https://api.tdameritrade.com/v1/oauth2/token"';
[response, curl_response] = system(command);
>>>>>>>
The response which is placed in one large string;
%%%%%
curl_response =
' % Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 2636 100 1489 100 1147 5304 4086 --:--:-- --:--:-- --:--:-- 9448
{
"access_token" : "n0f9jeyyc",
"scope" : "PlaceTrades AccountAccess MoveMoney",
"expires_in" : 1800,
"token_type" : "Bearer"
}'
%%%%%