 Okay, today we're going to be looking at the Chrome browser and we're going to be looking at the console and Chrome browser. If you've used Chrome, you may have noticed if you hit F12, it brings up a little console down here at the bottom with lots of options, elements, resources, networks, that sort of stuff. And today in particular, we're going to be looking at the network tab. This will show you every request and response coming from the webpage that you're currently on. In this case, I'm logged into Facebook, I have a created account, especially for this tutorial. And what I'm going to do is make sure that this is clear because it just makes it easier. So there's a clear button here because if I was to refresh the page, you'll see that there's a bunch of stuff that just appeared and if I clear that out, it's going to make it easier to figure out which is the post that I need. So I'm going to click in here and right away you'll see some more stuff pops up. It's the JavaScript calling all this stuff here. So again, I'm going to, before I click post, right before I click post, I'm going to click that clear button. But what we're going to be doing is retrieving information that we're posting in Chrome and using that in the shell with Curl. Now you may have heard me mention Curl before, I'm sure I've used it in tutorials before. It's similar to WGet, which I use quite often. WGet is probably installed by default on your system, that is if you're running Linux, and if you're one of my viewers, I'm assuming you're running Linux, WGet will be installed by default. But Curl may or may not, but it should be in your repository. So like on a Debian-based system, use your package manager, your software center, or as I prefer aptitude or apt-get, just search Curl, C-U-R-L and install it. Now Curl, just like WGet, you can type in Curl in a URL and it will download that file, either the HTML file or a JPEG or a MP3, whatever you link it to. You can also submit forms with them relatively easy. The problem comes in when you're in a account such as Facebook, where you need login credentials, which can get confusing, they're logging into a site with WGet and Curl, it's relatively simple in general, but then you have sites that require cookies and it just starts getting more and more complex, can be done, but you kind of have to know what you're doing a little bit more than just downloading or submitting a form on a regular site. Luckily, as I said, Curl's console here will give us all that information in a single Curl command. So what I'm going to do is I'm going to come up here, I'm going to type in Hello World. And just before I click post, I am going to click this little clear button again, click post, and we get this status update PHP. That is the web page that we just submitted that information to. My posts didn't show up here right away. I'm going to, oh, I didn't mean I should have copied that before I refreshed. So there's my post. I'm going to quickly delete that, delete, click up in here, clear this, and I'm going to type again, Hello World. And before I click post, you notice it's doing a bunch of searches here. Basically, that's what it's doing is if you are a Facebook user, I know a lot of my viewers detest things like Facebook. But you know, as you type, if you start typing someone's name, it will search through your friends and it does kind of an autocomplete. That's what this little search thing that's popping up here. So as we're typing, it's making requests to the server. But I'm going to click clear, post. There it is, status update. If I click on that, it shows me all the information sent. It shows me the cookie information sent. It shows me the form information that was sent. And we need all this stuff when we post something to Facebook. So that would be a lot to type out yourself and figure out what it is you do and do not need. So what we're going to do is we're just going to right click where our status update here. And we have a few options here, but we're going to use the one that says copy as curl. So that's copied to our clipboard now as a curl command. So now I can bring up my terminal here. I'm going to control shift V, paste in that information. Let's go full screen here so you can see that a little bit better. Let me clear the screen. There we go. So now you can see we got the curl command. Make sure, once again, that you have curl installed. The URL that we are submitting this information to. And then it has a bunch of other stuff here. It's curl. We're passing it the cookie information we need. And our user agent here. So it's saying everything just like it would in the Chrome browser down here somewhere right here. You can see the message of hello world. It's in there twice in this particular instance. I'm not sure what this first one is for. I'm sure there's an importance to it. But I know updating my status is the second one that I want to change. But if I hit enter here, in many cases, I will get an error. In fact, I'll hit enter just to see. So we get some gibberish output here. That's just the output from the PHP site. If it output plain text, we would get that in this case. And sometimes here, this gibberish here will mess up your terminal. So we're going to take it, handle that here in a second. Also, sometimes again, error out here. I don't know if this particular case this is messing up so we don't get the error. But I'll explain what the error is and why this did not work, because if I go back to my browser here and hit F5, you can see that I have my one post, which was my initial post. I did not get the second post from the terminal. And the reason for that is, by default, Chrome gives you the command with these quotation marks. And unfortunately, some websites, and in this case, Facebook, some of the information being passed, has special characters in it that my shell sees as special characters, rather than the particular characters they're supposed to be. So it messes up the command. So what we need to do is change all those quotations to single quotes. So all double quotes to single quotes, which is the same as an apostrophe. Now we can manually go through and change all those. But a simpler way of doing that would be probably to create a file called mycurl here. Just a plain text file, I'm using vim as my text editor. And I will ctrl shift v, save, and exit out of that file. So now I can cat out mycurl, which is the same command. But I'm going to pipe that into tr. And tr, if you watched my previous tutorials, you can use tr or said, right here I'm just saying, substitute all double quotes with a single quote. Boom, I get the output. It hasn't run the command yet, but now I can highlight this, copy and paste it. So you can right click, copy, right click, paste. Or if you're familiar with Linux, once it's highlighted, it's copied. And we just have to center click to paste it. I will hit Enter. And once again, we still get that output here, which once again can mess up your terminal. So what I'm going to do is actually redirect that into dev forward slash null. OK, going back to my browser, I will hit F5 here. And you'll see that I do not have the updated posts. And I'm not 100% sure why. It may be that it's seeing it as the exact same post. So what I'm going to do in this case is I'm going to delete this post. And I'm going to up arrow and run my command one more time. I have had that happen to me before, and I think it's because I didn't change anything at all in the command. So there, if I refresh, you can see that post is there now. Run it again. Let's see if it gives me a double post. Yeah, because I'm posting the same exact information, the same cookies, the same text, it's not seeing it as a new command. So what I'm going to do, which may have originally happened, but I will tell you for sure, the changing the double quotes, the single quotes will fix the particular problem I was talking about. Maybe in this case, I didn't have that issue. But if you ever have a problem where it's giving you error, give that your first try at fixing it. But now if I hit up arrow and I start moving back until I get to where it says xhpcmessage equals, which is the second place where it has my message, because the first one is xhpcmessage text equals. And you could change both, but I do know just changing the second one is the one that will change the post that I'm seeing in my browser. So I'm going to change this from saying hello, world to hello, tux. I will hit Enter. Once again, we redirect it to null, so it gives us a nice little output here. I'll hit F5. And Facebook sometimes runs slow. Refresh it again. There we go. So now we have hello, world, and hello, tux, just by changing the text. I'll go back in here. And I will change it again just to show you. Let's see, it might be faster to go this way. So basically, you can take this output now that we've created it and put it into a shell script. Let's change this, say, metalx1000 hit Enter. Come back here, refresh my Facebook page. And there we go. We have hello, metalx1000, hello, tux, hello, world, all separate posts, just by changing the text. So yeah, I guess the issue I was having earlier in this particular case was that I was posting the same exact information. Let me try posting that same information again. Refresh it. Yeah, so if you post the same exact thing with the same exact cookies and everything, it sees the same post. As long as you change the text in the post, it sees it as a new post. But also, in certain cases, you're going to want to fix those double quotes to single quotes. May have not been the case here. But you could take this, put it in a script now, and automate updates. You can have your script check another website, grab information from it, and update your page. So I mean, there's third-party applications do that, but now you can do it yourself with Curl. You can also just have it automatically just post random things every hour or every 15 minutes just by using a while loop and a sleep command. So one last thing before I finish this video is what I've got up on the screen right now is I said I create a special account just for this tutorial. This information I have up on my screen right now, if that was my actual account, I would not want to be displaying that because anyone who has this information can manipulate my posts on Facebook. So if you do do this and you do put it in a script, be sure you keep that script secure where other people aren't going to have access to it because it is the key to your account and posting. So definitely keep it secure. But if you have a secure system and just want to write something, once again, this is also not just for Facebook. You can use this with pretty much any site. And it's great. I've used it with Google Voice to send text messages, which you can also do through regular email, but actually using my number, I can send text messages with Google Voice. I have had it to where I can use it to make my phone ring with Google Voice and complete a call for me all just by copying as curl in the Chrome browser, hit F12, and it will show you everything that's coming and going from this page. So I hope you enjoyed this kind of label. This is a quick tip. It wasn't all that quick, but the basic concept is quick. I just wanted to show you F12. And when you get something, you can right click and copy as curl to get that information for your shell scripts. Once again, if you have any questions, because I'm betting people will for this one, do not ask technical questions in the comments below. It is a great way not to get answered, unless it is a simple question I can answer in one sentence. If you have questions that are technical, please visit our IRC channel. It's on FreeNode. It's Pound Films by Chris. Chris with a K. Can't remember that or don't know how to use IRC. Just go to my website, filmsbychris.com. Chris with a K. There's a link in the description. Click on Social Network. Click on Help. And it should bring you to a web-based IRC client. I'm not always in there, but there are other people in there that are very helpful. Be patient. Come in. Don't plan on getting your question answered in the first few minutes. Come. Hang out. When people are talking, ask a question. See if anyone can help you. But that's about it. I thank you for watching. I hope you enjoy the tutorial. And I hope that you have a great day.