user2956298
user2956298

Reputation: 1

How to send an external request to a web service

I need to send a request to a external web Service, My web service return a json. The 2 projects are local. The first is localhost/symfony... and the second localhost/login/index.php

  $uri = "http://localhost/login/index.php";
  $request =  Request::create($uri, 'GET', array('test' => 'test'));

I do not know how to send the request and retrieve the response.

Upvotes: 0

Views: 333

Answers (2)

user3303133
user3303133

Reputation: 105

you can use file_get_contents() to get the data in json format from your web service, and later you can parse it using json_decode().

Upvotes: 0

Broncha
Broncha

Reputation: 3794

Request object are for internal use. You better use HTTP clients like

Upvotes: 2

Related Questions