$url = "myurl";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$passwordStr = "$this->username:$this->password";
curl_setopt($ch, CURLOPT_USERPWD, $passwordStr);
curl_setopt($ch, CURLOPT_HTTPHEADER,
array("Content-type: application/atom+xml"));
$successCode = 200;
$result = curl_exec($ch);
curl_exec從myurl獲取xml數據,如預期的那樣,但只是在輸出緩衝區中回顯它。 $return
的值是一個簡單的布爾值。相反,我希望它返回所獲得的XML數據作爲一個數組或任何其他的php對象,我可以處理(無需做任何繁瑣的ob_start
輸出緩衝)。這是可能的還是有任何解決方法?curl在php中 - 如何獲得數組或其他資源獲得的數據