Below We provide an example of how to use "Yes Postcode Search" API in PHP. You only need to replace your api key and search terms. This is really simple sample of code. Let us know, If you think these examples could be improved.
$curl = curl_init(); $version = '1'; $apiKey = '1234567890123456789012345678901234567890'; $postcode = 'YP3 1OK'; $escapedPostcode = str_replace(' ', '%20', $postcode); $format = 'json'; $api_url = "https://api.yespostcodesearch.co.uk/api/$version/postcode/$escapedPostcode.$format?key=$apiKey"; curl_setopt($curl, CURLOPT_URL, $api_url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($curl); curl_close($curl); echo $result;