darroosh
asked on
PHP CURL problem
Hi all , I'm trying to user PHP curl to open a connection with another server to send it a file and then get the reply to manipulate it ...
This worked fine with me :
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$target_url);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$result=curl_exec ($ch);
curl_close ($ch);
//echo $result;
But , this line :
$result=curl_exec ($ch);
do execute the CURL connection and automatically prints the reply even when I'm commenting the final line " the echo statement "
So the final reply is always printed ...
I don't want that ..
I want to get the result in a variable to manipulate it not to print ..
Any advice?
This worked fine with me :
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$target_url);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$result=curl_exec ($ch);
curl_close ($ch);
//echo $result;
But , this line :
$result=curl_exec ($ch);
do execute the CURL connection and automatically prints the reply even when I'm commenting the final line " the echo statement "
So the final reply is always printed ...
I don't want that ..
I want to get the result in a variable to manipulate it not to print ..
Any advice?
curl_exec() does not print anything. There is something else going on. Can you please post the entire script exactly as you have it now? You can obscure passwords and things like that but please make sure that the logic and line numbers are 100% the same. Thanks, ~Ray
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I searched and found the solution .. Posted it here as it may help someone..