使用BitBucket API将json数据转换为HTML
我收到一个请求,要求Bitbucket API在使用Guzzle的Symfony中运行良好。但是,我不确定如何在代码中将其转换为html以显示请求的不同部分 请求如下:使用BitBucket API将json数据转换为HTML,html,json,bitbucket,guzzle,bitbucket-api,Html,Json,Bitbucket,Guzzle,Bitbucket Api,我收到一个请求,要求Bitbucket API在使用Guzzle的Symfony中运行良好。但是,我不确定如何在代码中将其转换为html以显示请求的不同部分 请求如下: $client = new Client(); // The provider provides a way to get an authenticated API request for // the service, using the access
$client = new Client();
// The provider provides a way to get an authenticated API request for
// the service, using the access token; it returns an object conforming
// to Psr\Http\Message\RequestInterface.
$request = $provider->getAuthenticatedRequest(
'GET',
'https://bitbucket.org/!api/2.0/repositories/xxxx/xxxx/refs/branches',
$token
);
$request2 = $provider->getAuthenticatedRequest(
'GET',
'https://bitbucket.org/!api/2.0/repositories/xxxx/xxxx/commits',
$token
);
$promise = $client->sendAsync($request)->then(function ($response) {
$body = (string) $response->getBody();
echo $body;
});
$promise->wait();
$promise2 = $client->sendAsync($request2)->then(function ($response) {
$body = (string) $response->getBody();
$object = json_decode($body, true);
var_export($object);
});
$promise2->wait();
我把它放在文件的末尾以返回任何数据
return $this->json([]);
基本上,我的目标是以html格式显示分支、部署和提交等内容,因此我想知道将请求转换为html需要什么(无论是在上面的代码中还是单独)?感谢您的帮助