Request a webpage

This is a discussion on Request a webpage within the Networking/Device Communication forums, part of the General Programming Boards category; I'm studying the principles of a primitive browser. I want to receive the source code of a webpage. I know ...

  1. #1
    Registered User
    Join Date
    May 2008
    Posts
    52

    Request a webpage

    I'm studying the principles of a primitive browser.
    I want to receive the source code of a webpage. I know little about this but i need to send some headers right?

    I would like to do it by using some proxy i made up in my computer just to test.

    Objective: Receive the source of a page "www.lol.com/page.html" for example, through localhost:8118 address

    I cant find any good example of this, can you help me?

    Thanks!

  2. #2
    int x = *((int *) NULL); Cactus_Hugger's Avatar
    Join Date
    Jul 2003
    Location
    Banks of the River Styx
    Posts
    902
    Google is your friend.
    1) Read up on the basics. Wikipedia has a Sample HTTP Request among other things...
    2) Wireshark - it's a program that lets you sniff network traffic. Go get it, and watch some HTTP requests go by. HTTP is simple enough to learn by example.
    3) Read some RFCs for the details.

    If you don't want to reimplement HTTP, and are more interested in the data and not the protocol, libcurl can save you from reinventing the wheel.
    long time; /* know C? */
    Unprecedented performance: Nothing ever ran this slow before.
    Any sufficiently advanced bug is indistinguishable from a feature.
    Real Programmers confuse Halloween and Christmas, because dec 25 == oct 31.
    The best way to accelerate an IBM is at 9.8 m/s/s.
    recursion (re - cur' - zhun) n. 1. (see recursion)

  3. #3
    Registered User
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    217
    I learnt alot from this site:
    http://web-sniffer.net/

    You just type the address you want to visit, and it will show you the headers sent and received, including new line characters and payload data.

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,451
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can you check what is wrong with this code
    By Ron in forum C++ Programming
    Replies: 4
    Last Post: 08-01-2008, 10:59 PM
  2. my HTTP request handler code correct?
    By George2 in forum C# Programming
    Replies: 0
    Last Post: 04-25-2008, 04:01 AM
  3. Replies: 15
    Last Post: 11-27-2007, 07:47 PM
  4. Downloading a webpage onto the disk?
    By Edin in forum Windows Programming
    Replies: 3
    Last Post: 11-23-2004, 12:37 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21