Reputation:
So my problem is that I am sending a curl
request to a website and it's always printing the HTML response, for example:
<html><header>Example</header></html>
This is how I executed my curl:
$output = curl_exec($ch)
I did not echo out $output
but it constantly returns the value over and over again.
Upvotes: 3
Views: 1865
Reputation: 842
You need to set CURLOPT_RETURNTRANSFER
to true
:
CURLOPT_RETURNTRANSFER: TRUE to return the transfer as a string of the return value of curl_exec() instead of outputting it out directly.
You can do this with curl_setopt
(quote above from this doc):
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true )
Upvotes: 9