| | |
UniqueID.html
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
Hello.
Ive got this small script which caches a web page. It names the file with a unique ID which is all fine but I need it to name it with the unique ID but with a HTML extention.
How would I do this?
Heres my script...
Ive got this small script which caches a web page. It names the file with a unique ID which is all fine but I need it to name it with the unique ID but with a HTML extention.
How would I do this?
Heres my script...
php Syntax (Toggle Plain Text)
<?php $page = file_get_contents('http://www.google.com'); $num = md5(uniqid()); $filename = $num; file_put_contents($filename,$page); ?>
Last edited by !Unreal; Dec 21st, 2008 at 10:50 pm.
php Syntax (Toggle Plain Text)
<?php $page = file_get_contents('http://www.google.com'); $num = md5(uniqid()); $filename = $num; $filename .=".html"; $handle=fopen($filename,"x+"); fwrite($handle,$page); ?>
Last edited by buddylee17; Dec 21st, 2008 at 11:58 pm.
Lost time is never found again.
- Benjamin Franklin
- Benjamin Franklin
Why not replace the random meaningless filename of with a unix timestamp which will record the files in chronological order and still be unique: ?
This way you would know exactly when each file was written.
php Syntax (Toggle Plain Text)
$num = md5(uniqid());
php Syntax (Toggle Plain Text)
$num = date("Ymd his"); $filename = $num." ".md5(uniqid(rand(), true)).".html";
This way you would know exactly when each file was written.
Lost time is never found again.
- Benjamin Franklin
- Benjamin Franklin
![]() |
Similar Threads
- Calculate Running total without ordered index (MySQL)
- I need to be able to hit Enter as well as clicking button. (VB.NET)
Other Threads in the PHP Forum
- Previous Thread: PHP FORM without senders email address
- Next Thread: Need Some Help With This Script
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax alerts apache api array beginner binary broken cakephp checkbox class cms code convert cron curl database date directory display download dynamic echo email error file files folder form forms function functions google hack href htaccess html htmlspecialchars image include insert integration ip java javascript joomla limit link login loop mail menu methods mlm mod_rewrite multiple mysql network object oop overwrite parse paypal pdf php problem query radio random recursion redirect regex remote script search securephp server sessions sms soap source space sql structure syntax system table tutorial update upload url validation validator variable video web xml youtube





