Programming HTTP communication

J

Jean Pierre MERX

I'm usually making my tennis reservations through a Web server
(http://t22-srtm-0171717070.paris.fr/srtm/jsp/web/index.jsp#). The drawback
is that you have to get up early in the morning in order to get your
preferred courts/timeslots...

I would like to have a short program which will:
- Connect to the Web server at a pre-defined time with my identification
data (user/pwd).
- Reserve my favorite tennis court at the preferred time.
- Disconnect from the Web server.

I don't really know what to use for building such "an application".

I looked to WinHttp API from MS Windows. The problem is to know what HTTP
request to make. For example during the identification phase, the Web server
is using Javascript with a form and a submit function. What is then sent as
HTTP commands ?

Is there a program that can "spy" the HTTP command sent by IE ? Would a
simple script program with TELNET commands be sufficient ?

Thanks in advance for your light!
 
B

bobzimuta

Jean said:
I would like to have a short program which will:
- Connect to the Web server at a pre-defined time with my identification
data (user/pwd).
- Reserve my favorite tennis court at the preferred time.
- Disconnect from the Web server.

You want a 'bot' and in my opinion they are frowned upon without
consent of the webmaster.
I looked to WinHttp API from MS Windows. The problem is to know what HTTP
request to make. For example during the identification phase, the Web server
is using Javascript with a form and a submit function. What is then sent as
HTTP commands ?

Regardless, learning about this kind of stuff is interesting. Install
Firefox and the LiveHTTPHeaders extension. It will show you all the
data transferring between your computer and the server.

http://www.mozilla.com/
http://livehttpheaders.mozdev.org/installation.html#
 
C

Csaba Gabor

Jean said:
I'm usually making my tennis reservations through a Web server
(http://t22-srtm-0171717070.paris.fr/srtm/jsp/web/index.jsp#). The drawback
is that you have to get up early in the morning in order to get your
preferred courts/timeslots...

I would like to have a short program which will:
- Connect to the Web server at a pre-defined time with my identification
data (user/pwd).
- Reserve my favorite tennis court at the preferred time.
- Disconnect from the Web server.

As Bob said, webmasters often don't like this. Sort of the pot calling
the kettle black, if you ask me, since what is having a webserver
besides automation? Program it up properly, though, and they won't be
able to tell the difference.

There are two parts. The second part is to schedule whatever task you
come up with to happen on a regular basis. You can usually do this
from Control Panel in windows (or AT or Schtasks from the command
line), or as a chron job on linux systems.

The first part is the underlying task. I suggest doing this with a
scripting language of your choice. You could accomplish it with
vbscript or php, for example. My recommendation is to actually bring
up an instance of IE (assuming windows) and manipulate it directly, as
if you were using the browser yourself:

(starter vbscript code):
Set ie = CreateObject("InternetExplorer.Application")
ie.visible = true;
ie.Navigate2 "TennisSite.com"
While ie.ReadyState<>4: WScript.Sleep 10: Wend
'Start filling out form here:
ie.document.getElementById("userName") = "JeanPierre"
ie.document.getElementById("password") = "tennisFanatic"
ie.document.forms[1].submit
'... wait for next page
'determine court preference, etc.


If you've never done this before, you'll have some [a lot of] learning
to do. But in the end, you'll get to sleep in.

Csaba Gabor from Vienna
 
B

bobzimuta

There are two parts. The second part is to schedule whatever task you
come up with to happen on a regular basis. You can usually do this
from Control Panel in windows (or AT or Schtasks from the command
line), or as a chron job on linux systems.

The first part is the underlying task. I suggest doing this with a
scripting language of your choice. You could accomplish it with
vbscript or php, for example. My recommendation is to actually bring
up an instance of IE (assuming windows) and manipulate it directly, as
if you were using the browser yourself:

I favor php as a personal preference. You can simulate a user's
browsing session using CURL (http://us2.php.net/manual/en/ref.curl.php)
though the initial setup may be more difficult. Then again if it was me
I'd use the socket functions
(http://us2.php.net/manual/en/ref.sockets.php).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top