PHP CURL post returning results but I need empty results
I'm doing curl post but the problem is that I need to return empty results so I can echo out another value for my ajax request results:
below is the code:
$ch = curl_init("http://www.rankreport.com.au/ajax/add_new_lead");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "lead_company_id=1&lead_business=1234&lead_first_name=asdf&lead_website=12314.com&lead_phone=1234&lead_email=test@test.com&lead_package=seo");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
开发者_如何学Python curl_exec($ch);
curl_close($ch);
echo 'error 3';
When I do this, I'm getting below results:
{"lead_date":1315637343,"lead_company_id":"1","lead_business":"1234","lead_first_name":"asdf","lead_last_name":"","lead_website":"12314.com","lead_phone":"1234","lead_email":"test@test.com","lead_package":"seo"} 3
How do set curl options so that it doesn't return any curl results?
Set CURLOPT_RETURNTRANSFER
:
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$result = curl_exec($ch);
Use CURLOPT_RETURNTRANSFER = true
to have the returned content as a return value ($ch) instead of output.
精彩评论