Posts Tagged ‘PHP’

“401 Authorization Required” with PHP

Sunday, June 15th, 2008

Very simple bit of PHP to add to the top of your script if you want to password protect something. I wouldn’t reccommend this for larger bits of software, but if you have a simple script or page that you don’t want people to access, try the following: (more…)

Read Wordpress RSS Feeds, YouTube Video Lists, and more…

Wednesday, April 16th, 2008

I needed to grab a couple of new blog entries on a website’s wordpress blog area, and put it on a non-wordpress home page. I ended up making a PHP 5 class that did the job for me. Very simple, no fancy stuff.

I then needed to get a load of youtube video posts on the same site from a specific account and had to make a list of that, with thumbnails etc. . I ended up tweaking the first class ever so slightly and lucky me, I had an easy feed reader.

(more…)

DOMDocument whitespace text nodes

Monday, March 31st, 2008

The DOMDocument is a convenient way of manipulating an XML file. One issue I ran into was the fact that when loading an XML file, DOMDocument treats the tabs and spaces which make the XML readable as empty text nodes. This presents a problem when you try and traverse the DOM by using attributes like firstChild and nextChild. For example:

Here is the XML file, “example.xml”:

    Value

(more…)