2014-10-06 82 views
1

如何在php中使用libcurl查看完整請求標頭,包括髮布數據?查看CURL的請求標題,其中包含POST數據

$username = ($_POST['t_user']); 
$password = ($_POST['t_pass']); 
$message = ($_POST['t_update']); 

$url = 'http://www.facebax.com/1/statuses/update.xml'; 
$curl_handle = curl_init(); 
curl_setopt($curl_handle, CURLOPT_URL, "$url"); 
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2); 
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($curl_handle, CURLOPT_POST, 1); 
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, "status=$message"); 
curl_setopt($curl_handle, CURLOPT_USERPWD, "$username:$password"); 

$buffer = curl_exec($curl_handle); 

我試圖讓curl_getinfo不是我需要 的數據,我想知道,如何在http://www.facebax.com/1/statuses/update.xml 我想使用這個API來我的移動應用程序發送

+0

可能重複(http://stackoverflow.com/questions/1828935/php-curl-and-raw-headers) – 2014-10-07 13:37:11

回答

1

我用這個什麼信息的命令關於捲曲信息:

$f = fopen('request.txt', 'w'); 
curl_setopt($curl_handle,CURLOPT_VERBOSE,true); 
curl_setopt($curl_handle,CURLOPT_STDERR ,$f); 
[PHP,捲曲,和生頭]的