示例#1
0
<?php

//--------------------------------------------------------------
// Examples: Quandl API
//--------------------------------------------------------------
require "./vendor/autoload.php";
if (file_exists(__DIR__ . '/.env')) {
    $dotenv = new Dotenv\Dotenv(__DIR__);
    $dotenv->load();
}
Kint::enabled(true);
$api_key = getenv('QUANDL_API_KEY');
$symbol = "GOOG/NASDAQ_AAPL";
// Modify this call to check different samples
$data = example1($api_key, $symbol);
d($data);
// Example 1: Hello Quandl
function example1($api_key, $symbol)
{
    $quandl = new Royopa\Quandl\Quandl();
    return $quandl->getSymbol($symbol);
}
// Example 2: API Key + JSON
function example2($api_key, $symbol)
{
    $quandl = new Royopa\Quandl\Quandl($api_key);
    $quandl->format = "json";
    return $quandl->getSymbol($symbol);
}
// Example 3: Date Range + Last URL
function example3($api_key, $symbol)
示例#2
0
<?php

function example1()
{
    $arr = '[
				"success": true, 
				"data" :{
					"name": "litiantian", 
					"chooce": "scuec"
				}
			]';
    echo $arr;
}
example1();