Skip to content

Instantly share code, notes, and snippets.

@nielsenrc
Created October 29, 2015 14:31
Show Gist options
  • Save nielsenrc/4b944b838b26b9873eec to your computer and use it in GitHub Desktop.
Save nielsenrc/4b944b838b26b9873eec to your computer and use it in GitHub Desktop.
PHP Function for Authenticated Calls to Ziptastic
<?php
function callZiptastic($zipcode, $referrerDomain, $apiKey) {
$url = "https://zip.getziptastic.com/v3/US/" . $zipcode;
$options = array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => 1,
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'x-referrer: ' . $referrerDomain ,
'x-key: ' . $apiKey,
));
curl_setopt_array($ch, $options);
$response = curl_exec($ch);
curl_close ($ch);
return $response;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment