How to fix curl?

Good evening, dear friends. Help to understand where I'm wrong:
$sss = curl_exec($curl);
As a result of executing this fragment of code in $sss needs to get the data. However, instead of data $curl just output a continuous stream on the page.

Here is a more detailed piece of code:
if ($access_token) {
 $curl = curl_init("https://bla-bla.com/positions");
curl_setopt(
$curl,
CURLOPT_HTTPHEADER,
array(
 'Accept: application/json',
 'Authorization: Bearer '.$access_token
)
);
 $sss = curl_exec($curl);
curl_close($curl);
 }
July 8th 19 at 12:14
2 answers
July 8th 19 at 12:16
Solution
Returns TRUE on success or FALSE on failure. However, if the CURLOPT_RETURNTRANSFER option is set, it will return the result on success, FALSE on failure.
php.net/manual/en/function.curl-exec.php
Something I hardly understand. What is the problem? - Selena commented on July 8th 19 at 12:19
: you need to add the option CURLOPT_RETURNTRANSFER = true - meggie commented on July 8th 19 at 12:22
Thank you! The real problem was this. - Selena commented on July 8th 19 at 12:25
July 8th 19 at 12:18
Curl is good, and Guzzle better.

Find more questions by tags PHP