Setting the http referer with PHP CURL

The PHP CURL functions use the libcurl library to allow you to connect to various servers and different protocols. If the http referer string is not explicitly defined then nothing will be sent to the web server, but there may be times when you need to pass this along with your request.

Categories PHP

PHP CURL and Cookies

PHP’s CURL functions make it easy to download content from websites. Sometimes you need to be able to manage cookies set from the site the data is coming from. This is done using the CURLOPT_COOKIEJAR and CURLOPT_COOKIEFILE options as shown in this post.

Categories PHP

Combine and minify Javascript files with PHP

If you’re using a Javascript library like jQuery it’s likely you’ll end up with many Javascript files that need to be included in each page request. Ideally these should be combined into a single file and minified to cut down on page load time. This post shows how to use jsmin-phpto combine multiple Javascript files into a single minified file.

PHP geo targeting with the geoip functions

The PHP GeoIP library makes it easy to look up country codes and names from an IP address. It’s not enabled/installed by default so you need to install it before you can access these functions. I’ve already posted about how to do this with Debian and other Linux distros will be similar.

Categories PHP