Search code examples
phpmysqlapachecentoskeyword

Copy text from a webpage


Let's say we have a website speedywap.com

When I open the website in my browser and then I copy the page to the clipboard and when I paste it in my notepad (windows) only text remains. All the code is removed except for the text that was in links etc (i.e displayed on the screen).

I want to do something similar with php because I am trying to create a keyword density analyser. So I want something that is able to just keep the text from a webpage that is displayed on the screen.

My server is running apache, php, centos and mysql


Solution

  • <?php
    $content = file_get_contents('http://speedywap.com');
    echo $content;
    ?>
    

    you can use strip_tags to strip tags from it then you are just left with text.