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
    New to the CF scene
    Join Date
    Oct 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Simple Php Fetching Script Code Edit?

    Hello Guys I need help urgent. I am beginner in PHP
    I have downloaded more then 100K pages of a website which are in html format, and want to fetch data from these files.

    What I want to fetch html tag to tag files

    e.g
    <title> to </title>
    or <div> to </div>

    in which I can easily fetch the data from downloaded files. One of my friends writes this script but don't know who to use this


    var string="comtag<title>AA</title>";
    indexOf=string.indexOf("<title>");
    first=indexOf+7;
    indexOf2=string.indexOf("</title>");
    alert(string.substring(first,indexOf2));

    I have a folder in which all files are downloaded name 'download' and want I want to fetch data and save into notepad files.
    Urgent script or code required
    Thanks
    John

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    That code is Javascript, not PHP.
    PHP would be better to do this with though. Even better would be to get rid of the old .html files. 100,000 files is a hellofalot of files though.
    Fetching data from them is a breeze so long as they are well formed. If they are, you can use XML handling to fetch and find what you need. If they are not, then it will be unpleasant.
    What is in these files? Are they following a logical naming convention? You may not need to actually do anything with them aside from using PHP to fetch template based off of them, but that will only work if there is a method in identifying them properly. You cannot loop through 100K files at a time looking for information; that would just take far to long.
    This of course all assumes that these pages are all you will ever have. You need to work to conversion of them and storing the data into a database, then serving dynamically. If these are batches of files that will constantly keep climbing, PHP isn't the language to do this with. You want to look into something much faster such as C.


  •  

    Posting Permissions

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