Support the ongoing development of Laravel.io →
Eloquent Forms Installation

I'm trying to fetch JSON data from an API and it's returning null. Here is my code:

		$movie_url = 'http://www.omdbapi.com/?i='.$request->imdb_id.'&r=json';
		
		$movie_data = json_decode($movie_url, true);
		
		echo $movie_url;
		echo dd($movie_data);

And if I go to the actual URL above http://www.omdbapi.com/?i=tt0076759&r=json, I get a full array.

I want to be able to insert this array into various fields in my database.

What am I doing wrong in getting the data?

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

jerauf jerauf Joined 16 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.