Thread: how we can convert html to text

  1. #1
    Registered User
    Join Date
    Aug 2006
    Posts
    90

    how we can convert html to text

    hi,
    iam reading the webpage using curl socket.
    so iam geting the data in html format
    so how can convert html data to text data ,so i can move forward.
    thank u,
    sree

  2. #2
    Registered User
    Join Date
    Oct 2007
    Posts
    54
    I am not able to get your question . . .

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Strip out everything which isn't inside a <tag> ?
    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.

  4. #4
    Registered User
    Join Date
    Aug 2006
    Posts
    90
    thank u for ur resopnse
    i read the google homepage with curl socket
    i got the follwing output
    Code:
    :
    <html><head><meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"><title>Google</title><style>body,td,a,p,.h{font-family:arial,sans-serif}.h{font-size:20px}.h{color:#3366cc}.q{color:#00c}.ts td{padding:0}.ts{border-collapse:collapse}</style><script>
    <!--
    window.google={kEI:"uE4XR5_ILYWu0QSw_IS9CQ",kEXPI:"0",kHL:"en"};function sf(){document.f.q.focus();}
    // -->
    </script>
    </head><body bgcolor=#ffffff text=#000000 link=#0000cc vlink=#551a8b alink=#ff0000 onload="sf();if(document.images){new Image().src='/images/nav_logo3.png'}" topmargin=3 marginheight=3><div align=right id=guser style="font-size:84%;padding:0 0 4px" width=100%><nobr><a href="/url?sa=p&pref=ig&pval=3&q=http://www.google.co.in/ig%3Fhl%3Den&usg=AFQjCNGcGDvIXIdfWIOFWg-J5Dx8ZlW-dA">iGoogle</a> | <a href="https://www.google.com/accounts/Login?continue=http://www.google.co.in/&hl=en">Sign in</a></nobr></div><center><br clear=all id=lgpd><table cellpadding=0 cellspacing=0 border=0><tr><td align=right valign=bottom><img src=images/hp0.gif width=158 height=78 alt="Google"></td><td valign=bottom><img src=images/hp1.gif width=50 he
    NOW wht i need is have to remove all the html tags and i need only text .

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    So what's the problem?
    You see a <, skip until >
    You see a <!--, skip until -->
    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.

  6. #6
    Registered User
    Join Date
    Aug 2006
    Posts
    90
    thank u.
    any string function for skiping the data

  7. #7
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Yes there is.
    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.

  8. #8
    Registered User
    Join Date
    Aug 2006
    Posts
    90
    plz tell me the function

  9. #9
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    You'll have to do the "skipping" yourself, but functions like strstr() and strchr() will help you find where to start and stop your skipping. If you look those functions up, there may be closely related functions that are also helpfull.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  10. #10
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > plz tell me the function
    Please look through string.h yourself and read the manual pages.

    If you at least familiarise yourself with what the standard C library is capable of (no one expects you to remember every last detail), then you won't need so much spoon-feeding in future.
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. html text boxes
    By herWter in forum A Brief History of Cprogramming.com
    Replies: 12
    Last Post: 12-06-2008, 01:34 AM
  2. read txt file as binary then convert to text
    By 911help in forum C Programming
    Replies: 2
    Last Post: 01-04-2008, 06:29 AM
  3. How to use FTP?
    By maxorator in forum C++ Programming
    Replies: 8
    Last Post: 11-04-2005, 03:17 PM
  4. how to convert a text file to a .dat file
    By Linette in forum C++ Programming
    Replies: 11
    Last Post: 02-25-2002, 05:58 AM
  5. Convert a text file to a binary file
    By Cyber Kitten in forum C Programming
    Replies: 16
    Last Post: 02-04-2002, 08:53 AM