json - log a stock/share price variable to database useing php -
i have api retrieves stock price data through php script. have tried several different ways add price database no luck.
please driving me crazy, have tried logging float different syntax still doesn't display, please kind enough give me example using code below new php/mysqli , programing in general. thanks. please note use import.io create api , have removed api key.
this how api works:
<?php $url = 'http://my api url.com'; $json =file_get_contents($url); $retval =json_decode($json, true); $output = "<ul>"; foreach($retval['results'] $results) { $output .="<p>".$results['price/_source']."</p>"; } $output .="</url>"; echo $output; // show price so: 1.139791 ?> '
//this json file.
{
"offset": 0,
"results":
[
{
"price": "1.140 293"
}
`]`,
"cookies": [ ],
"connectorversionguid": "2af429a0-3fa4-4e67-b9bf-fbf453674ccb",
"connectorguid": "87343523-d4c8-47db-b582-5408be1b679b",
"pageurl": "http://www.x-rates.com/calculator/?from=eur&to=usd&amount=1",
"outputproperties":
[
`{` `"name": "price",` `"type": "string"` `}` `]`
}
Comments
Post a Comment