PHP

PHP – use a regular expression to extract a URL from XML attribute

I was working on an API response, which provided data in a custom XML markup within the string, which was returned. I wanted to simply extract the “linkTerm”. The snippet I got looked like this:

Now surely there will be more elegant ways of doing it, but I felt that I wouldn’t be guaranteed […]

PHP – removing unwanted XML from string

Yesterday I was working on a small PHP script in which an API sends “xml” within the response. That XML is supposed to make handling the data easier, but to be fair I just didn’t need it. This is the snippet that the API returned

At first I tried to simply use PHP’s strip_tags() […]

PHP File Upload with UPLOAD_ERR_INI_SIZE

If you created a multipart/form-data form to upload a file to your server and it gives you an error 1 (UPLOAD_ERR_INI_SIZE) , you need to update the php.ini for your machine. PHP.ini is usually found in /etc/  directory of your server. On my AWS AIM Linux instance the current PHP Version is 5.6 and thus the file […]

Translations with gettext() and POEdit not working on your Ubuntu server?

I tried to get gettext() translations going on a Ubuntu 16.04.2 server and while the code was solid, there was one major bit missing – the locale was not available on the server. So if you have the same problem – simply run for each locale you plan to support:

So what does it do? […]

Scroll to top