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: <link linkTarget=”URL” linkTerm=”https://some.provider.com/lib/something/detail.action?docID=5176530″ linkWindow=”_blank”>Online-Zugang</link> Now surely there will be more elegant ways of doing it, but I felt that I […]

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 <searchLink fieldCode=”AR” term=”%22Krugman%2C+Paul+R%2E%22″>Krugman, Paul R.</searchLink> At first I tried to […]

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: sudo locale-gen de_DE So what does […]

Scroll to top