朋友们,我正在尝试解决我如何访问光晕到达api for get state bungie已经发布api for this here链接http://www.bungie.net/fanclub/statsapi/Group/Resources/Article.aspx?cid=545064
如何通过php访问此服务并显示一些需要帮助的统计信息
我正在尝试这样
<?php
require_once('lib/nusoap.php');
$wsdl = "http://www.bungie.net/api/reach/ReachApiJson.svc?wsdl";
$client = new soapclient($wsdl, 'wsdl');
$parameters['parameters']['apikey'] = "xxx";
$result = $client->call("GetGameMetadata", $parameters);
?>
答案 0 :(得分:2)
在PHP中使用JSON非常简单。
<?PHP
$uri = 'http://www.bungie.net/api/reach/reachapijson.svc/game/metadata/xxx';
if (! $json = file_get_contents($uri)){ //cURL can be faster and more flexible, but this ought to work
trigger_error('API call failed!');
}
if (! $result = json_decode($json)){
trigger_error('API returned bad data?');
//maybe log some stuff here, so you can debug.
}
print_r($result); //see what you got.