Open karussell opened 9 years ago
For anyone using @Guzzle and @Symfony Components:
use Symfony\Component\Serializer\Encoder\JsonDecode;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', $uri);
$decoder = new JsonDecode();
$routing = $decoder->decode($response->getBody()->getContents(), JsonEncoder::FORMAT);
We got a request asking for how to do an API request via PHP. The most important part is to use the correct URL:
Or for the routing API:
Then use the $str for further JSON parsing or use httpful a HTTP client making such requests easy for PHP.
Our route optimization API contains a swagger specification from which you can easily create an already working PHP client. Contact us if you do not know how to handle that.