By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,812 Members | 1,978 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,812 IT Pros & Developers. It's quick & easy.

IO::Socket...HTTP/1.0\n\n needs to be HTTP/1.1\r\n

P: 1
I can not use the LWP module, and must use IO::Socket. Using 'Wireshark' and Mozilla and passing in the parameters below I get a valid reply. However Wireshark shows HTTP needs to be 1.1 and that the Internet line terminator needs to be "\r\n" and not "\n\n". How do I get IO::Socket to use the 1.1 Protocol? Also, how do I get Perl to indicate it is a Mozilla browser? I have been Googling this for several hours and am unable to find anything of use. Any help is appreciated. John
Expand|Select|Wrap|Line Numbers
  1. use IO::Socket;
  2. $first_name = 'Steve';
  3. $last_name = 'Dunn';
  4.  
  5. $sym_url = "/cgi-bin/pd.exe/search?p1=$last_name&p2=$first_name&p3=&input=grp_sxo_name&type=name&dlnumber=CC&dlstate=CC";
  6.  
  7. $socket = IO::Socket::INET->new
  8.         ( PeerAddr => 'search.criminalcheck.com',    
  9.         PeerPort => 80,  
  10.         Proto => 'tcp',  
  11.         Type => SOCK_STREAM,      
  12.         Reuse => 1)  
  13.  
  14. # this does not work:
  15. print $socket "GET $sym_url HTTP/1.0\n\n";
  16. # I think the server wants this:
  17. print $socket "GET $sym_url HTTP/1.1\r\n\n";   # BUT it doesn't wk either
  18.  
  19. while (<$socket>) {       # read in entire web page line by line
  20.         print "$_\n";
  21.     print OUT_HTML $_;        # Writes each line as it is read to the filehandle "OUT"
  22.  }
  23.  
  24.    ### done reading web page
  25.     print "\n\n----- done with web page -------\n\n";
  26.  
  27. ## for testing the URL I am using is:
  28. #http://search.criminalcheck.com/cgi-bin/pd.exe/search?p1=Dunn&p2=Steve&p3=&input=grp_sxo_name&type=name&dlnumber=CC&dlstate=CC
  29.  
Oct 9 '08 #1
Share this Question
Share on Google+
1 Reply


Icecrack
Expert 100+
P: 174
First Please use code tags,

Second Change:

Expand|Select|Wrap|Line Numbers
  1. print $socket "GET $sym_url HTTP/1.1\r\n\n"
to:

Expand|Select|Wrap|Line Numbers
  1. print $socket "GET $sym_url HTTP/1.1\r\n"
Oct 10 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.