PHP

Never use file_get_contents to make URL queries

Why you should not ever use file_get_contents

As each programmer by nature I’m lazy. I try to accomplish as much as possible in minimum effort.

So whenever I use PHP to fetch something I’m using file_get_contents to make queries, and pull data from other services. So basically my favourite snippet is this guy here:

PrestaShop margin size on delivery slips

Recently one of my clients contacted me asking if I can make a change. Shrink a little bit huge margins on PDF delivery slips. The task wasn’t easy because settings is bit hidden in the files. By modifying templates you can change font size, and amend or remove elements from the printout. Unfortunately you can’t actually decrease margin on PDF printout.

PHP returning wrong date

PHP returning wrong date

From time to time we are working on small campaigns, where competition starts at given time. Because in Australia we have “so many” timezones, it’s critical to set things correctly according to the time zone.

GeoIP extension PHP 7.x + AMI / Redhat / CentOs Linux

GeoIP extension PHP 7.x + AMI / Redhat / CentOs Linux

Small 2019 update – Please check out this library – github.com/maxmind/MaxMind-DB-Reader-php It’s a straight replacement of PHP module. GeoIP extensions is quite use-full, but it requires some server – side magic. If you are looking for something simpler, just go with ipstack.com or something similar – GeoIP . Otherwise: wget http://pear.php.net/go-pear.phar php go-pear.phar We need geoip-devel libraries: yum install geoip-devel And newest (not stable) version of geoip: sudo ./pecl install geoip-1.