Skip to content

Instantly share code, notes, and snippets.

@maestrojed
Created March 11, 2024 19:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maestrojed/484aef483f73173325650fa6c2a5a54e to your computer and use it in GitHub Desktop.
Save maestrojed/484aef483f73173325650fa6c2a5a54e to your computer and use it in GitHub Desktop.
$api_key = "";
$ph_number = "";
// Initialize cURL.
$ch = curl_init();
// Set the URL that you want to GET by using the CURLOPT_URL option.
curl_setopt($ch, CURLOPT_URL, 'https://phonevalidation.abstractapi.com/v1/?api_key='%api_key'&phone='.$ph_number);
// Set CURLOPT_RETURNTRANSFER so that the content is returned as a variable.
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Set CURLOPT_FOLLOWLOCATION to true to follow redirects.
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
// Execute the request.
$data = curl_exec($ch);
// Close the cURL handle.
curl_close($ch);
//format the JSON into a table (tables can be saved as CSVs). This will be easiest for admins
$ph_number_data = json_decode($data);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment