I am looking for data for a list of companies from the CrunchBase API, and then add this data to the selection tables in the database. I really don't know where to start. I look at cURL.
Where am I now:
$url = "http://api.crunchbase.com/v/1/company/audible-coffee.js?api_key=API_KEY&callback=?";
$data = get_data($url);
$data = str_replace("<head>", "<head><base href=\"$url\">", $data);
echo $data;
function get_data($url) {
$ch = curl_init();
$timeout = 5;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_close($ch);
return $data;
}
I think I should parse it now and then save the data in the database.
My efforts to find the code when analyzing the data are as follows:
$json_string = '<url.json>';
$jsondata = file_get_contents($json_string);
$obj = json_decode($jsondata, true);
print_r($obj['Result']);
Unfortunately, I do not know what I am doing, so any contribution to what I need to change or where to go will be greatly appreciated.
source
share