Symfony2 - How to perform an external Request

后端 未结 6 1633
走了就别回头了
走了就别回头了 2020-12-14 01:48

Using Symfony2, I need to access an external API based on HTTPS.

How can I call an external URI and manage the response to \"play\" with it. For example, to render a

6条回答
  •  有刺的猬
    2020-12-14 02:16

    https://github.com/sensio/SensioBuzzBundle seems to be what you are looking for.

    It implements the Kris Wallsmith buzz library to perform HTTP requests.

    I'll let you read the doc on the github page, usage is pretty basic:

    $buzz = $this->container->get('buzz');
    
    $response = $buzz->get('http://google.com');
    
    echo $response->getContent();
    

提交回复
热议问题