1<?php
2
3$postRequest = array(
4 'firstFieldData' => 'foo',
5 'secondFieldData' => 'bar'
6);
7
8$cURLConnection = curl_init('http://hostname.tld/api');
9curl_setopt($cURLConnection, CURLOPT_POSTFIELDS, $postRequest);
10curl_setopt($cURLConnection, CURLOPT_RETURNTRANSFER, true);
11
12$apiResponse = curl_exec($cURLConnection);
13curl_close($cURLConnection);
14
15// $apiResponse - available data from the API request
16$jsonArrayResponse - json_decode($apiResponse);
1<?php
2
3$cURLConnection = curl_init();
4
5curl_setopt($cURLConnection, CURLOPT_URL, 'https://hostname.tld/phone-list');
6curl_setopt($cURLConnection, CURLOPT_RETURNTRANSFER, true);
7
8$phoneList = curl_exec($cURLConnection);
9curl_close($cURLConnection);
10
11$jsonArrayResponse - json_decode($phoneList);