In the last episode, we set up our environment. Now we have the Instagram folder, we have installed composer and then we've installed the guzzle package. I've also added the require vendor autoload and I'm referencing the client new guzzle HTTP request. So now at this point, we're ready to transition this code to work with Instagram. And that's pretty easy actually, this method. So I'm going to go over to my F my Instagram account here, which is a public account, which is HTTP DubDubDub instagram.com/trevor Greenleaf, which is my account. I'm going to grab that and where it says this URL, I'm going to replace that like that. And then after the slash I'm going to just write media. Then this is going to say, echo Rez gets that as code Rez, get headline content type and Rez get body, and we'll see what it shows. So we'll click refresh now.
And here we go. 200 application type is Jason item code. It says the user, it says full name, Bubba do profile. And then it goes on for a while here, as you can see from the scroller on the bottom quite a long time, well, we don't need to echo the status code. I know it's going to be good. It's always going to be a 200. I don't need to know the content type because we know it's Jason at this point. So now I have this [inaudible] body. I'm probably want to take that data and do a Jason decode and maybe a print are on it. So let's get started with this. So I'm going to say, I'm going to call this data and our data is equal to raise a get body, right? And that's actually going to get the request data that got sent back from here.
This is pretty easy to get started with. We're going to go and take this. Now, this Rez get body, uh, and put a Jason decode around it, and then we're going to wrap the parentheses. So you'll see that extra parentheses. And then I'm going to do a print our on the data, and we'll put a semi-colon there. Now, if we refresh this, you're going to see there's our object with our arrays inside of it, with an object inside of that. And there is the data look at all that data, and it's nicely formatted and pretty easy to go and reference. So we've managed to integrate very quickly the data from, uh, from guzzle using that request, converting it to a, which was already Jason and converting it with Jason decode code now, uh, and then printing our that array. So we have this nice object and array syntax set up. So in the next episode, let's go in and write some code to loop through this inside PHP, and then maybe give it a little bit of style.