2016-08-17 108 views
-2

有人知道如何將其轉換爲PHP?或者也許可以轉換。如何將其從curl轉換爲php

curl -X DELETE "https://api.cloudflare.com/client/v4/zones/fjsdf834u8fhsdfh343/purge_cache" \ 
    -H "X-Auth-Email: [email protected]" \ 
    -H "X-Auth-Key: c254fsdfg34320b638f5e225c545fsddasc5cfdda41" \ 
    -H "Content-Type: application/json" \ 
    --data '{"purge_everything":true}' 

回答

0
$ch = curl_init ('https://api.cloudflare.com/client/v4/zones/fjsdf834u8fhsdfh343/purge_cache'); 
curl_setopt ($ch, CURLOPT_CUSTOMREQUEST, 'DELETE'); 
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true); 
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, false); 
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, false); 
curl_setopt ($ch, CURLOPT_HTTPHEADER, array (
    'X-Auth-Email: [email protected]', 
    'X-Auth-Key: c254fsdfg34320b638f5e225c545fsddasc5cfdda41', 
    'Content-Type: application/json' 
)); 

curl_setopt ($ch, CURLOPT_POST, true); 
curl_setopt ($ch, CURLOPT_POSTFIELDS, '{"purge_everything":true}'); 

echo curl_exec ($ch); 
+0

沒有工作...( – jason

+0

@jason檢查您的憑證 – 2016-08-17 07:49:31

+0

everithing都是確定的憑證 – jason