function curlZoomLogin($username, $password) { $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, 'https://api.zoominfo.com/authenticate'); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_MAXREDIRS, 10); curl_setopt($curl, CURLOPT_TIMEOUT, 0); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); $data = array("username" => $username, "password" => $password); $data_string = ra_json_encode($conn, $data); curl_setopt($curl, CURLOPT_POSTFIELDS, $data_string); curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); $server_output = curl_exec($curl); curl_close($curl); return $server_output; } function curlgetzoominfo($conn, $firstname, $lastname, $company) { $t = curlZoomLogin("XXXXX", "YYYYY"); // Removed from this example $r = ra_json_decode($t); $jwt = $r["jwt"]; $curl = curl_init(); $url = "https://api.zoominfo.com/enrich/contact"; $data = array("matchPersonInput" => array(array("firstName" => $firstname, "lastName" => $lastname, "companyName" => $company),), "outputFields" => array("firstName","lastName","companyName","email","phone","state","jobTitle")); $data_string = ra_json_encode($conn, $data); curl_setopt_array($curl, array( CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_CURLOPT_POST => true, CURLOPT_POSTFIELDS => $data_string, CURLOPT_VERBOSE => true, CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', 'Authorization: Bearer ' . $jwt ), )); $server_output = curl_exec($curl); curl_close($curl); return $server_output; } $firstname = "Phil"; $lastname = "Reeve"; $company = "Reeve & Associates"; $t = curlgetzoominfo($conn, $firstname, $lastname, $company); if (isset($_GET["d"])) { echo $t; }