0
我对入门文档的游离碱,在那里我会用我的API密钥在这个例子困惑:PHP - 我在哪里使用freebase API密钥?
<!DOCTYPE html>
<html>
<body>
<?php
include('.freebase-api-key');
$service_url = 'https://www.googleapis.com/freebase/v1/topic';
$topic_id = '/en/bob_dylan';
$params = array('key'=>$freebase_api_key);
$url = $service_url . $topic_id . '?' . http_build_query($params);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$topic = json_decode(curl_exec($ch), true);
curl_close($ch);
echo $topic['property']['/type/object/name']['values'][0]['value'];
?>
如果我创造我的服务器上的PHP文件,该键去在这个文件中?在网址?
你想要做什么或者它是不是你想要的? – qooplmao
这是本页面的一个示例:https://developers.google.com/freebase/v1/topic-overview,它应该“检索Freebase主题并显示主题名称” – user2219915
如果我的api密钥是blahblahblah,并且我把php页面放在example.com/freebase.php,我尝试创建url http:http://example.com/freebase.php?key=blahblahblah,但我没有' – user2219915