Last active
August 21, 2019 15:44
-
-
Save nickgs/89f99e0c92ac2afd5ffff56d11b4f9fd to your computer and use it in GitHub Desktop.
ADC Product API PHP Curl Example
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 | |
$product = "700-11ABK"; | |
$curl = curl_init(); | |
curl_setopt_array($curl, array( | |
CURLOPT_URL => "https://www.adctoday.com/api/v1/product/{$product}", | |
CURLOPT_RETURNTRANSFER => true, | |
CURLOPT_ENCODING => "", | |
CURLOPT_MAXREDIRS => 10, | |
CURLOPT_TIMEOUT => 30, | |
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, | |
CURLOPT_CUSTOMREQUEST => "GET", | |
CURLOPT_SSL_VERIFYHOST => false, | |
CURLOPT_SSL_VERIFYPEER => false, | |
CURLOPT_HTTPHEADER => array( | |
"Accept: */*", | |
"Accept-Encoding: gzip, deflate", | |
"Cache-Control: no-cache", | |
"Connection: keep-alive", | |
"Host: www.adctoday.com", | |
"cache-control: no-cache" | |
), | |
)); | |
$response = curl_exec($curl); | |
$err = curl_error($curl); | |
curl_close($curl); | |
if ($err) { | |
echo "cURL Error #:" . $err; | |
} else { | |
echo $response; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment