13 articles PHP Page 2 / 3

Typical way to send CURL POST data in PHP

Here is a typical way to send PHP data to another script and have that data returned via CURL POST. Keep in mind there are a lot of server security restrictions that may impede CURL from working properly. Visit the PHP cURL book to learn more.

The basic way to work with file attachments for users to download files via hyperlinks in PHP

This is always something that seems to be overcomplicated, if you generate PDFs or other files and use some form of AJAX to call that file, how do you force the user's browser to treat the link as an attachment for them to save on their computer? You have to make sure the script hasn't…

Mysql PDO standard insert (persist) of data to a table with placeholders to protect from MySQL injection attacks

This is a much more secure way to insert records and prevent MySQL injection.  This assumes that $this-conn is your MySQLi PDO database connection object that you've already initialized: Please note that a lot of the PHP snippets on this site assume you have some level of PHP experience.  I use this site as…

Redirect a webpage with PHP

There are plenty of reasons to need to redirect a page.  If you do, you here is a sample PHP code snippet that will allow you to point a page to another page on your site or any other site quickly and easily. This script needs to be the first lines of the script, before…

Automatically generate a list of clickable hyperlinks of certain files within the same folder

This snippet comes in handy and has saved me hours of menial coding tasks.  Let's say you have a customer that you do a lot of work for and you want them to access certain files.  In my case, I produce and edit a lot of TV commercials for clients.  I never hard code their…