Skip to content

Instantly share code, notes, and snippets.

@stanleybz
Last active April 10, 2021 05:49
Show Gist options
  • Save stanleybz/f29a35f89b52e48507bc6611216d97f6 to your computer and use it in GitHub Desktop.
Save stanleybz/f29a35f89b52e48507bc6611216d97f6 to your computer and use it in GitHub Desktop.
<?php
$curl = curl_init();
curl_setopt ($curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt ($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.cloudflare.com/client/v4/zones?status=active&match=all",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"X-Auth-Email: YOUR_CLOUDFLARE_EMAIL",
"X-Auth-Key: YOUR_GLOBAL_API_KEY",
"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