Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Apr 2012
    Posts
    104
    Thanks
    27
    Thanked 2 Times in 2 Posts

    script which can read source code of a page?

    for example i have 1000 webpages, and thier usl of the form - example.com/example.php?page=1, example.com/example.php?page=2, ....... , example.com/example.php?page=1000, now if there is written a word - hello on any two out of thousand pages, supposing i have the method of finding source code of all of the pages, i can put it all through loop and find what two pages have hello written in them using regexp. But problem is how can i make my program read page's source code?
    Everything is simpler with jQuery!

  • #2
    Regular Coder Lerura's Avatar
    Join Date
    Aug 2005
    Location
    Denmark
    Posts
    946
    Thanks
    0
    Thanked 129 Times in 128 Posts
    you could load your example.php's in an iframe.
    <iframe id="Tester" onload="Test();">

    Code:
    var Currentpage=1;
    var MaxPage=1000;
    var HitPages=[];
    function Test(){
    TestFrame=document.getElementById('Tester');
    Content=TestFrame.contentDocument.body.innerHTML;
    isMatch=Content.match(/hello/);
    if (isMatch){
    HitPages.push(CurrentPage);
    }
    CurrentPage++;
    if (CurrentPage <= MaxPage){
    TestFrame.src="example.com/example.php?page="+CurrentPage;
    }else{
      // code for handling the result (HitPages)
    }
    }
    window.onload=function(){document.getElementById('Tester').src="example.com/example.php?page="+CurrentPage;}


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •