2014-09-10 143 views

回答

6

您可以使用curl_setopt_array()而不是curl命令行標誌。

<?php 
$curl = curl_init(); 
curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://api.newrelic.com/v2/applications.json', //URL to the API 
    CURLOPT_HEADER => true, // Instead of the "-i" flag 
    CURLOPT_HTTPHEADER => array('X-Api-Key:100') //Your New Relic API key 
)); 
$resp = curl_exec($curl); 
curl_close($curl); 
print_r($resp); 
+1

非常感謝您的時間! – 2014-09-10 15:09:55