Last active
December 16, 2015 00:09
-
-
Save guptag-dev/5345376 to your computer and use it in GitHub Desktop.
Coverage/All Eligibleapi client in PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Eligible API url*/ | |
$url = 'https://gds.eligibleapi.com/v1.1/coverage/all.json'; | |
// Assign parameter values here | |
$service_type_code = ''; | |
$api_key = ''; | |
$payer_name = ''; | |
$payer_id = ''; | |
$service_provider_first_name = ''; | |
$service_provider_last_name = ''; | |
$service_provider_npi = ''; | |
$subscriber_id = ''; | |
$subscriber_first_name = ''; | |
$subscriber_last_name = ''; | |
$subscriber_dob = ''; | |
/* $_GET Parameters to Send */ | |
$params = array( 'service_type_code' => $service_type_code, | |
'api_key' => $api_key, | |
'payer_name' => $payer_name, | |
'payer_id' => $payer_id, | |
'service_provider_first_name' => $service_provider_first_name, | |
'service_provider_last_name' => $service_provider_last_name, | |
'service_provider_npi' => $service_provider_npi, | |
'subscriber_id' => $subscriber_id, | |
'subscriber_first_name' => $subscriber_first_name, | |
'subscriber_last_name' => $subscriber_last_name, | |
'subscriber_dob' => $subscriber_dob, | |
); | |
/* Update URL to container Query String of Paramaters */ | |
$url .= '?' . http_build_query($params); | |
/* cURL Resource */ | |
$ch = curl_init(); | |
/* Set URL */ | |
curl_setopt($ch, CURLOPT_URL, $url); | |
/* Tell cURL to return the output */ | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
/* Tell cURL NOT to return the headers */ | |
curl_setopt($ch, CURLOPT_HEADER, false); | |
/* Execute cURL, Return Data */ | |
$data = curl_exec($ch); | |
/* Check HTTP Code */ | |
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE); | |
/* Close cURL Resource */ | |
curl_close($ch); | |
/* 200 Response! */ | |
if ($status == 200) { | |
/* Process your data here */ | |
var_dump($data); | |
} else { | |
/* Handle error here */ | |
var_dump($data); | |
var_dump($status); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment