LswApiCallerBundle POST数据

时间:2016-08-01 11:14:21

标签: symfony curl

我想使用Symfony2和LswApiCallerBundle调用此API:https://api.airbnb.com/v2/search_results

按照说明我使用以下代码拨打电话:

$url = 'https://api.airbnb.com/v2/search_results';

$data = [
    'client_id' => '3092nxybyb0otqw18e8nh5nty',
];

$output = $this->get('api_caller')->call(new HttpGetJson($url, $data));

结果我得到了这个:

  

状态:0连接失败网址:   https://api.airbnb.com/v2/search_results类型:   Lsw \ ApiCallerBundle \ Call \ HttpGetJson请求:35字节原始html解析   响应:0字节原始html解析时间:62.89毫秒

使用" null"响应。有人可以告诉我,我在哪里失败,或者有其他办法吗?

由于

1 个答案:

答案 0 :(得分:0)

我找到了一个解决方案,用Lsw Bundle代替Guzzle one(https://github.com/LeaseWeb/LswGuzzleBundle)。 请按照文档进行配置。