 Welcome back to the channel. I'm going to register for a new account here on this URL. After signing up, I have an account that I'll be using and I'll be giving it particular data to actually use. So the first thing that I'm going to do is go back to our text that we had saved here. So if you don't have this, you should be able to go look back in the previous video to see how we actually got this space. So what I'm going to do is actually I'm going to go and copy our function where I was just sending data and basically I'll show you how this runs in a little bit. So in iIncludes folder, we shall include send sms. So we'll just call it outgoing sms.php. So that's why we shall put our function and basically we need to first wrap this with our php for it to be recognized. So we're going to send data. Before we make any query, we are not going to do any query whatsoever. We just need to reduce all that code. What we are going to do is we are going to be having a URL and the URL in this particular case. Let me just cut this. We're going to be using this URL to test for the JSON and I'm going to copy this and test it here. So we'll need a URL, which is just a variable. The next thing that we're going to do is that we shall need arguments which we're going to be sending to our body. So in our body, we'll need to send the user data that's the username and password. In my method, it will be post. But as I post my body, I'm going to require to pass a method called balance. Then we're going to get the user data, the user data will have the username and the password. So first things first, I'm just going to use the WordPress WP remote post and pass in my URL. And then for now, let me close off this body and see what response we get. So I'll get this send data, I'm going to come back to the admin here and pass in that as our function. So let me just copy all this information here, bring it back to our admin and we're going to just pass this down and see what happens. So let us refresh our page. If I refresh, we'll see that we get back a response. We get a status of 200, but we also get a body that says failed, we pass the wrong JSON in our, in our post. So let's see how we can do this. So what we're going to do, we'll allow for a fail error to come and else we're going to the remote retrieve and we're going to use a body and we're going to pass in our response. And then we shall see that should be our error that we pass back. So I'm going to just take this away. Let's just pass back our remote error. If everything goes right, let's just get back that. So the reason everything fail is because we don't have a method, we don't have a username and password passed into a method here. So what I'm going to do before all this happens is I am going to structure out my data to see that I get it right. So what we're going to do is we're going to get our data and then we're going to JSON encode it. Now when we JSON encode, we need to pass in the arguments that we are going to be adding. So I'll save this and I'll save my arguments are going to be this. So I'll set up and say the arguments that I need first and foremost is I'm going to have an array because if you look at this, this is an array of data. So I'll have an array and the first part that I'm going to pass here is a method and the method will be a string of balance. So what we're going to do is let's just dump this so that we can see what's happening. So let's dump our data. The next piece we need is we're going to need the user data here and the user data is going to require an array of our data to be passed. So in this array, we're going to have the username and the password. So I'll pass in username and then I'll have password. So let me get this, pass this in, copy this and pass this in. So let's see how this looks like and we have it clean. So this is what we are required to pass and what we have here. So let me pass in my username and see that this is correct, which is going to be this and then my password is going to be plugin. Let's test this and see it looks like that and let's unwrap this so let's see what happens this time around. When we pass, we get a status of this. Oh, the reason why this messed up is because in my body, I have not passed the arguments. So copy this, pass the arguments here as the body and in here we're just going to, we're just going to pass in, I just need to change this to args. I'll pass in args here, then here I just need to pass that data because we convert this to data or I can just simply get this here, cut it, pass it in here and then just get rid of all these lines of code and make it a little neater. So let's reload this and see what we get back and we have our balance. So we have a status of okay and we have our balance. So what we need to do here is just make this look neat by adding some style and a number of things. So I'm going to pass some spans in here. So I'll open and close this, then wrap this in double quotes, cut this too, put it here and then I'll just add in some dots to period so that I can just get the response and when we get the response, what we're going to do here, so we're going to have to Jason decode it. Let me just do this a little bit earlier. So Jason decode this, so make this response equals that Jason decode. Now we're going to be having objects here. So in here we shall be having an object of balance. So let's reload this, see what happens. Let me vah-damp this with some pre-tags. So vah-damp, let's get the response before we echo it out. So we have status, we have balance here. So let me add some pre-tags to see what I'm working with. Move this up, duplicate it, move this down and then close it off with that. So let me see our response. So we have a status and a balance. So it's a capital B. So after Jason decoding our response from up here, we'll save it in menu. Let's just make this different. We'll call this balance so that it's very obvious. So we'll call this balance. Now we're going to get back our object and the object will have balance to it just like we see here. So when I save this and reload, we should have our balance of this. So we have our balance which is 10,000. So if we wanted to make it, we know it's an integer value, we can type, hint it and say it's a value or we can even say we want it to be with a number format. So we'll pass that in and then we'll add a comma zero so that we don't have any sense to it. So let me reload this and you'll see that we now have a comma in between our piece. So we can always say this is the balance and then type this in paragraph tag. So we can always make this look nice but for now we have our information coming back and this is the balance that we are going to use to be able to send. We're not going to always have to cross check because we're going to send our SMS from here. We're not always going to have to check the API to see our balance. So what I'm going to do is I'm going to capture all this data and then I am going to save it in a custom database or I can save it in the WordPress database as an option. So I would like to always refer to this information. So what I'm going to do is I'm just going to create a database and I will save all this information in there so that it has the date and the time when this balance was so. So let's just do that in the next video. Let's create a new custom database to store all our data.