Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

AndrewBen's avatar

Curl not returning any results

I don't really understand how curl works and this is my first time using curl in laravel. Whenever i try to make a call to any url i get noting, no errors, just no results. here is the code....tell me what you think the error is

THE ROUTE
// HACK: CURL call
Route::get('/ajaxa', [
'uses' => '\Skylearn\Http\controllers\CurlController@curl',
       'as'  => 'ajaxa.index',
       'middleware' => ['auth'],
]);

THE CONTROLLER

class CurlController extends controller
  {
    public function curl()
    {
 $response = Curl::to('https://curl-url')
        ->get();
       
    }


// REVIEW:// DO NOT REMOVE THE CLOSING TAGS BELOW
  }

THE BLADE AS JUST HELLO WORLD I DON'T KNOW IF I SHOULD MAKE A CALL OR NOT

<p>hello world</p>

I really need curl in this project and i would love it if anyone can answer this... Thanks a lot.

0 likes
4 replies
davestewart's avatar

What's Curl::to ? Some kind of cURL helper?

Generally curling, you'll need to target a URL, so 'https://curl-url' won't cut it - as it's not a real URL.

Stick whatever URL you want to download in there and see what happens.

bashy's avatar
bashy
Best Answer
Level 65

You would use Guzzle here...?

1 like
AndrewBen's avatar

Nice, just checked the documentation and it seems simple enough. @bashy is there a documentation for laravel

Please or to participate in this conversation.