Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Conecting directly to port 80...

Posted on 1998-10-05
5
Medium Priority
?
212 Views
Last Modified: 2013-12-25
Hello,
Not sure if this is the proper place for this question but...
I need to create a script that connects to port 80 of a specfic server.
The conecting part is not the problem. But when I try to "talk" to the server to retrieve a site. The script would behave as a browser, retrieving the page and any images asociated withit.
So the question really is:
How di I format a proper request method to a web server?
I tried:
get index.html http/1.1
get / http/1.1
and none worked. I tried reading the RFC for http1.1 and it was just to technical for this semi-geek.
All I need to do is retrieve the main file and parce out anything that would be in font bigger than 3 or in bold...

Thanks for your help
0
Comment
Question by:sinner052397
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 11

Expert Comment

by:mouatts
ID: 1828926
Your first answer is almost correct if you aren't going via a proxy. If you are you must use the absolute URL and not the relative one.

I think that http should be HTTP.

Make sure that the line is terminated with a CR and LF


Steve
0
 

Author Comment

by:sinner052397
ID: 1828927
How would a fully correct answer look like?
From a telnet session, without a proxy, I tried:

get index.html HTTP/1.1   and I got HTTP/1.1 400 Bad Request
get / HTTP/1.1   and I got HTTP/1.1 400 Bad Request
get get http://www.sf.cl   HTTP/1.1 and I got  HTTP/1.1 400 Bad Request

My other question is, if you do not know the name of the first page, what is the proper call? If I connect to cnn.com how do I know wether to ask for inex.html index.htm default.htm default.asp, etc...
could it be because I am trying this through a telnet session as oposed to throug the script and thus not emulating a browser?

Thanks again,
Marcelo


0
 

Author Comment

by:sinner052397
ID: 1828928
I also tried:
get /index.html HTTP/1.1
GET index.html HTTP/1.1
GET /index.html HTTP/1.1
and none worked...

0
 
LVL 7

Accepted Solution

by:
faster earned 300 total points
ID: 1828929
GET / HTTP/1.0\r\n
\r\n
0
 
LVL 7

Expert Comment

by:faster
ID: 1828930
In short, you need 1 empty line.  The complete request format is:

Reguest line\r\n
header1: value1\r\n
header2: value2\r\n
.
\r\n

\r\n can also be replaced with \n, but \r\n is better, because that is the http standard.
Headers are optional for http 1.0, but in http 1.1, You must have a "Host" header, the host is the name of the server, for example:

Host: www.microsoft.com\r\n
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This tutorial will give you a fast look what you can do with WhizBase. I expect you already know how to work with HTML at least, and that you understand the basics of the internet and how the internet works. WhizBase is a server-s…
This tutorial will discuss fancy secure registration forms, with AJAX technology support. In this article I assume you already know HTML and some JS. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you mig…
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question