• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 241
  • Last Modified:

HTTP request

Hello. I'm downloading a webpage with winsoc. I just wonder how to format the HTTP request so it does not send this:

HTTP/1.0 200 OK
Date: Thu, 13 Apr 2006 11:52:01 GMT
Server: Apache/1.3.27 (Unix)
Cache-Control: max-age=900
Expires: Thu, 13 Apr 2006 12:07:01 GMT
Last-Modified: Thu, 13 Apr 2006 11:51:23 GMT
ETag: "2b400e-214fd-443e3b3b"
Accept-Ranges: bytes
Content-Length: 136445
Content-Type: text/html; charset=iso-8859-1
X-Cache: HIT from www.vg.no
Age: 561
X-Cache: HIT from www.vg.no
Connection: close

//
// Format the HTTP request
//
sprintf(szBuffer, "GET %s HTTP/1.1\nHost: %s\n\n", lpFileName, lpServerName);

//GET /index.html HTTP/1.1
//Host: www.vg.no
0
m-jansen
Asked:
m-jansen
  • 4
  • 2
1 Solution
 
rahul_r_jadhavCommented:
I think you need
GET index.html HTTP/1.1

0
 
rahul_r_jadhavCommented:
i mean instead of sending

//GET /index.html HTTP/1.1
//Host: www.vg.no

just send
GET index.html HTTP/1.1
0
 
rahul_r_jadhavCommented:
I didnt write code but connected to 80 port of www.vg.no using telnet
and sent
GET /index.html HTTP/1.1
it worked...
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
m-jansenAuthor Commented:
But it still sends all the stuff about date, server and etc. I only want the content of the html file. How to only get only that? Do I need to parse what I get to exclude it or is it some kind of mechanism to control it?
0
 
B1-66ERCommented:
Hi m-jansen.

HTTP specification does not provide command, which will return only html page content. All http responses always contain HTTP headers.
What you need, is to parse response, till you get \n\r symbol, after it begins your html content.
0
 
rahul_r_jadhavCommented:
yep... you need to parse it!!
0
 
m-jansenAuthor Commented:
thank you
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now