Closed GianNipitella closed 8 years ago
The problem is that your request is being redirected. You must add the appropriate options to your cURL request so this is handled properly:
$api_url="http://www.freecodecamp.com/news/hot";
$response = \Curl::to($api_url)
->withOption('FOLLOWLOCATION', true)
->get() ;
dd($response); // shows results as expected
Also, I see that the request no longer returns json, so I suppose you should also remove the 'asJson()` option :-)
FYI: first google result on Google: http://stackoverflow.com/questions/21233771/php-curl-function-301-error
i'm Using Laravel 5.2 with ixudra/curl problem is that when i do
But when i do $api_url="http://www.freecodecamp.com/news/hot"; $response = Curl::to($api_url) ->get() ; dd($response); the above shows some html code that still is not what i need what i really need is the information that shows when u acces http://www.freecodecamp.com/news/hot directly from browser how do i get it what am i doing wrong?