2010-06-12 60 views
0

我有一個關於CURL的問題。 我正在嘗試發送CURL請求到http://whatismyipaddress.com如何獲得CURLs在數組中的響應

so .. 是否有任何方法可以在數組中獲得curl響應? ,因爲現在它顯示HTML頁面,但我想在數組中的響應。

這裏是我的代碼...

$ipAdd = '121.101.152.170'; 
$ch = curl_init("http://whatismyipaddress.com/ip/".$ipAdd); 
curl_setopt($ch, CURLOPT_HEADER, 0); 
curl_setopt($ch, CURLOPT_POST, 1); 
curl_setopt($ch, CURLOPT_FOLLOWLOCATION ,1); 
curl_setopt($ch, CURLOPT_HEADER,0); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
$output = curl_exec($ch);  
curl_close($ch); 
echo $output; 

所以..現在我越來越詳細的HTML頁面,但我想的出來把作爲數組或XML。

+0

你這個數組或XML在想什麼?目前,「\ n」分割可以幫助您。 – 2010-06-12 08:14:39

+2

正如Shrapnel上校指出的,除非事先得到書面許可,否則這違反了WhatIsMyIPAddress.com [使用條款](http://whatismyipaddress.com/terms-of-use)。 – 2010-11-27 23:31:20

回答