HELP! Extract text from web page

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tesla

    HELP! Extract text from web page

    Hey guys, i need help on writing PHP code to go to an HTML page
    (http://example:8343/index.html), and pass the text on that page onto a
    variable. I dont know how to do this.

    What i plan to do is parse through the variable to look for a list of some
    things so i can display it on my page. Can anyone please help? Thanks



  • Pedro Graca

    #2
    Re: HELP! Extract text from web page

    Tesla wrote:[color=blue]
    > Hey guys, i need help on writing PHP code to go to an HTML page
    > (http://example:8343/index.html), and pass the text on that page onto a
    > variable. I dont know how to do this.
    >
    > What i plan to do is parse through the variable to look for a list of some
    > things so i can display it on my page. Can anyone please help? Thanks[/color]

    <?php
    $html_in_site = implode("\n", file('http://example:8343/index.html'));
    // now parse $html_in_site
    ?>

    fopen() can also open URLs

    maybe you need CURL ( @ http://www.php.net/curl )
    --
    --= my mail box only accepts =--
    --= Content-Type: text/plain =--
    --= Size below 10001 bytes =--

    Comment

    • Chung Leong

      #3
      Re: HELP! Extract text from web page

      Or $html_in_site = file_get_conten ts('http://example:8343/index.html'); if
      you have PHP 4.3.0+.

      Uzytkownik "Pedro Graca" <hexkid@hotpop. com> napisal w wiadomosci
      news:c110la$1d5 rr0$2@ID-203069.news.uni-berlin.de...[color=blue]
      > Tesla wrote:[color=green]
      > > Hey guys, i need help on writing PHP code to go to an HTML page
      > > (http://example:8343/index.html), and pass the text on that page onto a
      > > variable. I dont know how to do this.
      > >
      > > What i plan to do is parse through the variable to look for a list of[/color][/color]
      some[color=blue][color=green]
      > > things so i can display it on my page. Can anyone please help? Thanks[/color]
      >
      > <?php
      > $html_in_site = implode("\n", file('http://example:8343/index.html'));
      > // now parse $html_in_site
      > ?>
      >
      > fopen() can also open URLs
      >
      > maybe you need CURL ( @ http://www.php.net/curl )
      > --
      > --= my mail box only accepts =--
      > --= Content-Type: text/plain =--
      > --= Size below 10001 bytes =--[/color]


      Comment

      Working...