php - How to make cURL not to show body of requested page? -


my code shows requested page, while want post data login

/////////////////////////////////////////////////// $login_url = $tt; $post_data = ('username='.$un.'&password='.$pw); $ch = curl_init(); // $agent = $_server["http_user_agent"]; curl_setopt($ch, curlopt_useragent, $agent); curl_setopt($ch, curlopt_header, 1); //curl_setopt($ch, curlopt_nobody, 1); // curl_setopt($ch, curlopt_cookiesession, 1); curl_setopt($ch, curlopt_cookiejar, 'userscookies/'.$un.'.cookie'); curl_setopt($ch, curlopt_cookiefile, 'userscookies/'.$un.'.cookie'); // curl_setopt($ch, curlopt_url, $login_url); curl_setopt($ch, curlopt_post, 1); curl_setopt($ch, curlopt_postfields, $post_data); // curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_followlocation, 1); // $postresult = curl_exec($ch); echo $postresult; ////////////////////////////// 



, request $serveruri complete login,

////////////////////////////// curl_setopt($ch, curlopt_url, $serveruri); $logdo = curl_exec($ch); echo $logdo; ////////////////////////////// 

i don't want show pages user
tried opt: curl_setopt($ch, curlopt_nobody, 1); nothing new.
what disable body in curl?

i don't want show pages user

then why echo ?

remove line :

echo $postresult; 

and nothing showed user. provided curlopt_returntransfer flag you've set.


using curlopt_nobody won't it, because curl send head request instead of post want. there's no way prevent server sending body, can ignore it.


Comments