Archive for the ‘HTTP’ Category
I’m currently about half-way finished with a project that allows a user to check their Myspace Mail inbox through WML and WAP (mobile internet standards). The user simply visits this service, dubbed mBridge at the moment, on their mobile phone. They will be prompted for their Myspace login information. mBridge will pass the credentials on to Myspace and retrieve the 10 most recent messages, strip any code, and display them for the user to read. For those of you interested in how this works, read on.
First, mBridge has a login page written in WML that includes a form allowing the user to type their email and password for Myspace. After the user submits this information, mBridge will take it and use it to connect to Myspace via sockets. A socket is opened to myspace.com, headers for the homepage are written, and a token is retrieved. mBridge then opens a socket to login.myspace.com and uses a POST request to send the user credentials. After a few redirects and setting of cookies, we have a valid session with Myspace. mBridge retrieves the mail center page and uses a regex to grab the dates on all of the messages, their subjects, and the message ids of all of them. Now we open a socket for each message found in the inbox and retrieve the content.
The subject lines are stripped of repetitive “RE:” flags and the messages are stripped of code that won’t display properly in a mobile browser. The user is sent a list of links to each of the messages for them to read. When they read a message, they have a link to respond to the message.
When a message is sent, we log back in, visit the mail center, read the message, simulate a click on the reply button, and insert the mobile users response in the field before clicking send.
The only thing Myspace might do is try to shut us down through legal methods. I’m not aware of anything illegal about what mBridge does, though I’m not a lawyer. I’d hope that since Myspace does not have a service competing with this they won’t get their panties in a bunch that their customers don’t have to login to something they made to get their messages, but really, can they continue to expect people to put up with a lack of updates, no integration with mobile phones, and constant errors?
I’ll admit, this is the second attempt at writing this article. There is so much information and it all relates to all the rest, so it’s hard to piece it together correctly. I simplified this a LOT, so forgive me if you’re looking at something that explains things in technical details.
First, the basics. Your computer has some sort of ethernet adapter in it. Some are wireless, and some are wired. Either way, that ethernet adapter allows you to connect to other computers in your local area network (LAN). Usually, you have some sort of hub (router, switch, etc) that all your computers talk to. This hub helps all of the computers on your LAN talk to each other without having to plug in to each other directly. If you only have one computer you’re probably plugged straight into the modem, otherwise you probably have your hub plugged into your modem.
Your modem is like your ethernet adapter, only it allows your LAN to talk to a wide area network (WAN) like the internet. Cutting out all the technical stuff, when you connect to the internet, your ethernet adapter talks to your hub, your hub talks to your modem, then your modem talks to the rest of the internet. When it does that, it will reach the equivalent of a modem on the other end which will talk to the hub on the other end, and finally it will talk to the computer you are trying to get to.
Here’s a diagram to help make sense of all that:
The computer that you end up talking to on the other end has a special name: server. It gets this name because it serves documents and files. It’s essentially just another computer, though they typically don’t have peripherals (keyboard, mouse, monitor, etc) attached and they usually come in a flatter box to fit in a rack.
The language that your computer uses to talk to a website depends on what you are trying to do. If you are trying to browse the web, you’re computers are going to be speaking HTTP – Hyper-Text Transfer Protocol. This protocol allows the two computers to communicate to fulfill your request for a document. If you are sending files, you might be using FTP, or if you’re using IRC, it’s a protocol of its own.
So you can see there are a lot of different protocols that your computer can use to access the internet. For now, you can just focus on HTTP since you probably won’t be doing a lot of development with the other protocols if you’re making typical websites; however, you should still recognize that they exist.