Download files from server php

To read directory contents you can use readdir() and use a script, in my example download.php, to download files In download.php you can force browser to send download data, and use basename() to make sure client does not pass other file name like ../config.php

Laravel – Model Class not found

Laravel 5 promotes the use of namespaces for things like Models and Controllers. Your Model is under the App namespace, so your code needs to call it like this: As mentioned in the comments you can also use or import a namespace in to a file so you don’t need to quote the full path, like this: While I’m doing a … Read more

How to run PHP locally on MacOS

OSX comes with php installed : So you can run your php file. But don’t forget to include your code between <?php … ?>. So now you can run in your terminal: Apache is not needed.

htmlentities() vs. htmlspecialchars()

From the PHP documentation for htmlentities: This function is identical to htmlspecialchars() in all ways, except with htmlentities(), all characters which have HTML character entity equivalents are translated into these entities. From the PHP documentation for htmlspecialchars: Certain characters have special significance in HTML, and should be represented by HTML entities if they are to preserve their meanings. This function … Read more

cURL request in Laravel

Give the query-option from Guzzle a try: I use this option to build my get-requests with guzzle. In combination with json_decode($json_values, true) you can transform json to a php-array.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)