php - Script does not work, shows no errors -
I have created a small script on the websites 'cache' copies, and as far as I can tell it coded well It is, though, when I run it in the browser, it does not work and does not show any errors.
My code:
& lt ;? Php // display errors please error_reporting (e-mail); Ini_set ('display_errors', 1); // Random string $ length = 5; $ String = ""; $ Letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; // Thanks for the StarkerFrov code while ($ length> gt; 0) {$ string. = $ Characters [mt_rand (0, strlen ($ letters) -1) ;; $ Length - = 1; } Get $ GET request from $ random = $ string // if (isset ($ _GET ['link'])) URL {$ link = $ _GET ['link']; $ Data = file_get_contents ("http: // $ link"); Send data to // html file file_put_contents ("/ cache / $ random.html", "$ data"); Echo "successfully cached. & Lt; br & gt; Link: http://example.com/cache/$random.html"; }? & Gt;
The code has a syntax error,
$ Random = $ string should be
$ random = $ string; After you edit them, always have a good idea to check your php files for errors. One way to do this (if you are on a Linux / Unix system) is to run a PHP command
php -l filename.php Using an online compiler (What I did with your code)
Comments
Post a Comment