Monday, January 11, 2010

PERL TCP Socket Codes without relying on LWP (Part 2: POST method)

As promised, here are the codes:

replace (GET method):
print S "GET /Login.aspx?a=apple&cat=main HTTP/1.1\nHost:www.theSiteDomainName.com\n\n";



with (POST method):

print S "POST /Login.aspx HTTP/1.1\nHost:www.theSiteDomainName.com\nContent-Length: 16\n\na=apple&cat=main"




Note that you don't need to put the query string in the URI. Instead you need to post the query string as output data. You also need to specify the length of your data. This is a tricky part. The easiest way is to put the data in a word file and check out the file properties (statistics) for the word count.



There are still two other types of TCP connection which I haven't mentioned:



1) HTTPS

2) Send and Receive Cookies



Hope I housekeep my info and post them up when the time is right.

No comments:

Post a Comment