31 users online (0 members and 31 guests)  


  Results 1 to 4 of 4

Related

  1. form data displayed on html page    Forum: PHP Forum
    Replies: 1
  2. javascript should be displayed in html    Forum: HTML Forum
    Replies: 0
  3. Replies: 8
  4. Parse HTML    Forum: PHP Forum
    Replies: 4
  5. TeXt-aReA bAcKrOuNd cOdE    Forum: HTML Forum
    Replies: 2
  1. #1
    blink's Avatar
    New User

    Status
    Offline
    Join Date
    Mar 2005
    Posts
    19

    How to parse displayed text from HTML code?

    Hello!

    Now that I managed to obtain a response from an html file, how can I parse the html code from the text? In other words, I need to get rid of all the <> tabs from the response.

  2. #2
    ALL's Avatar
    Super Dooper Nerd

    Status
    Offline
    Join Date
    Feb 2005
    Location
    localhost
    Posts
    382
    verry simple:
    Code:
    $response =~ s/<//g;
    $response =~ s/>//g;
    Last edited by ALL; 03-29-2005 at 02:57 PM.

  3. #3
    blink's Avatar
    New User

    Status
    Offline
    Join Date
    Mar 2005
    Posts
    19
    Quote Originally Posted by ALL
    verry simple:
    Code:
    $response =~ s/<//g;
    $response =~ s/>//g;
    Perhaps I was a bit unclear...

    If I have the following response:

    <title>my title</title>

    I want to parse the text inside the tags, meaning that only the MY TITLE part would be left and all anything between and icnluding < and > characters would be left out.

  4. #4
    ALL's Avatar
    Super Dooper Nerd

    Status
    Offline
    Join Date
    Feb 2005
    Location
    localhost
    Posts
    382
    ok, sorry about that, this code should work:
    Code:
    while($response =~ /</){
    $deldat = substr($response, index($response, '<'), index($response, '>')-index($response, '<')+1);
    $response =~ s/$deldat//g;
    }



Tags for this Thread