Flat txt database help!

Einklappen
Dieses Thema ist geschlossen.
X
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • Flat txt database help!

    Hi Guys

    My question/problem is in relation to an admin script, which I'm trying
    to write for a search script. Basically what it needs is a way to validate (URL)
    records in the simple text database. I am not able to write this thing as my
    Perl / PHP is not this advanced. If someone could take a shot at writeing this
    thing for me I'd be very grateful. I know this is a lot to ask but I really
    am at a loss I'd be happy to send you £20 for your trouble.


    The format of the database is as follows:

    There are 6 fields.

    date_time type title description url keywords name

    The delimiter is ----


    Example: -

    12/27/2000 09:46:11----html----Sublite Web Design----Sublite Web Site Design Services.----http://www.sublite.co.uk----sublite,website,development,site,internet----(none given)



    You should write a script that loops though the database and tests each
    record to see if it's URL is working.

    The script then should delete any record(s) which point to dead URL's
    and produce 404 errors etc.

    To do this you could.


    Issue a HTTP HEAD request and check for the returned headers.
    Look at the fsockopen() function in the manual, it gives you an example;
    just replace the line with GET by these ones :

    fputs($fp, "HEAD $path HTTP/1.1\r\n");
    fputs($fp, "Host: $host\r\n");
    fputs($fp, "\r\n");

    Before doing this, use the parse_url() function to extract all the
    components (host, port, path...) of the URL.

    The HTTP return code comes in the first header line :

    HTTP/1.1 code message

    Check for the different possible values (corresponding to Ok, Not found,
    Redirection, Not authorized...).

    To check the urls, use fsockopen, send a http request and read one line of
    whatever the webserver answers, that contains the result. 200=ok, 404=not
    found etc.

    And to get the URL, you could just use split(), and look for ----, it will
    split your string into an array, in which your URL field would be array[4].
    Then you would use fsockopen() and get the result.



    I do hope this makes sence.

    Best Regards


    Greg


    greg@sublite.co.uk



    php-Entwicklung | ebiz-consult.de
    PHP-Webhosting für PHP Entwickler | ebiz-webhosting.de
    die PHP Marktplatz-Software | ebiz-trader.de
Lädt...
X