Tag: PHP

Identify a (web) link in a string with PHP

If you want to process some text and output the same text with HTML links automatically created for you, then look no further: $newstring = preg_replace(‘!(http|ftp|scp)(s)?://[a-zA-Z0-9.?&_/]+!’, “<a href=”\” target=’_blank’></a>”,$sting);

Tagged with:

Displaying your latest Tweet in PHP – updated

Back in 2011 I posted a method for displaying your latest tweet in php. However times change, and the twitter API has been changed beyond all recognition. I have updated my script to interpret the JSON response from the latest

Tagged with: , ,

Using PHP to calculate a simple checksum

There is a very specific set of rules for sending a message in most protocols, and the checksum is sent at the end of a message to make sure no corruption has occurred in transmission. In the instance of sending a

Tagged with: , ,

Sending data to a specific port using PHP

I have made a bit of a breakthrough on my back-burner project at work, last mentioned here on 2010 in a post on SQLite connections. As mentioned in that post there is a door control application that runs on a

Tagged with: ,

PHP/MySQL dates

I have posted before as to a MySQL date, i.e. Y-m-d can be converted in a previous post here. I found myself this evening in need of converting UK dates back into the MySQL format. Now, the strtotime() function requires

Tagged with: , , ,

Display your latest Tweet in PHP

So on my mobile site (http://cyte.co.uk/mobile) I created a button to link to my Twitter and this very blog you are reading. This got me thinking what I could do to keep the content fresh without much effort. As the

Tagged with: ,

Make your website mobile friendly

With an ever-growing percentage of people with access to mobile web browsers in their pockets, the time is ripe to take steps to optimise your site for mobile users. I’ll be posting as I go through getting my own site

Tagged with: ,

Converting stored MySQL dates into UK format

You will no doubt be aware that when you save a date in a MySQL database, it must be in the form of Y-m-d. I had some difficulty wrestling with the date() section of the PHP manual , and experimented for

Tagged with: , ,

PHP pagination of search results

Displaying data from a database in a webpage is something every web developer needs to do very frequently. I remember my early attempts at displaying a certain number of records per page like a Google search to be immensely frustrating

Tagged with: ,

PDO/SQLite connection

I have been working for a while on a project involving running a PHP web application on on an ARM linux mini PC. There was an existing application on the PC whose SQLite database I needed to manipulate, to feed

Tagged with: , , ,