Skip to content

Tag: PHP

Twitter, PHP oAuth: update status

Recently Twitter announced they are going disable basic authentication mechanism. Basic auth can be used until June 30th 2010, so there is only less then one month left (assuming you are reading this on June 2010). I admit that for a long time i neglected the OAuth Twitter authorization, it seemed complicated and time consuming in comparison basic auth.

However, when i found out they are shutting down the basic api, i had no other choice then to learn how it works. What it turned out is that with the right tools it’s pretty easy to do. Especially if you are (like me) looking to setup application that will be using only single user. For example to automatically update your status. Continue reading Twitter, PHP oAuth: update status

XInclude and XPointer – Advanced XML Part 2

This is the second part Advanced XML and PHP series. If you haven’t read first part you can find it here: Introduction to XPath in PHP. You may be not interested right now but unfortunately topic of todays article (XPointer and XInclude) are extensions of XPath, so it would be very helpful if you would go thru it right now, i assure you that XPath is very interesting technology and knowing it may benefit somewhere in the future. Continue reading XInclude and XPointer – Advanced XML Part 2

PHP XPath Tutorial – Advanced XML Part 1

Few years back when i first read book about XML i could not understand what the hyip was all about, some markup language that allows to store data in well organized way. I also remember parsing XML files in PHP few years back. Whole file was raed using fread() and then programmer had to create some kind of parser to process XML file … completely ridicolous. Sure ActionScript, probably Java and some other languages as well already had classes for parsing XML files, but that was not the case for PHP, so i thought that this is a technology that do not deserve a second look. Continue reading PHP XPath Tutorial – Advanced XML Part 1

PHP Coding Standards

There is a lot of articles on the Internet about: becoming better programmer, writting better and more readable code, where someone just makes a list of techniques or tips (as they call it) that will make you a better programmer. In fact these articles are usually far from providing you with valuable information and most of the time can be summarized with two words – coding statndards. Continue reading PHP Coding Standards

PHP AutoLoad Best Practices

Few days ago my friend Mark, added on my blog interesting comment regarding autoloading objects in PHP. While i think it is great to have quality comments like each of Mark’s comment, autoloading is a topic that requires a separate post.

What is autoloading? Every time you want to use a new class in your PHP project, first you need to include this class (using include or require language construct, that’s right this are not functions). However if you have __autoload function defined, inclusion will handle itself. Continue reading PHP AutoLoad Best Practices

PHP redirect header location

Ok finally i managed to write a new article after about a month ( actually i do not even want to think when i wrote last good article for you). Anyway today short article on using headers to redirect vistors to other pages on your site or external site.

To do this you need only one function
header($header, $replace, $http_response_code);

First argument $header is a header itself. We want to use header to redirect visitors so in our case we will use something like “Location: URL” where URL is obviously an url of a page to which you want to redirect visitor. It can be full url ( or relative URL (pages/page.html) Continue reading PHP redirect header location

Developing Webbots, Spiders and Screen Scrapers with PHP cURL

For a long time i wanted to write detailed tutorial on how to use PHP and cURL to create bots and i am still going to do that, but while browsing Amazon i found very interesting book related to this topic A Guide to Developing Internet Agents with PHP/CURL written by Mike Schrenk. I did not read this book yet, but it looks very promising and interesting … atleast to me, because it is not yet-another-php-for-beginners, but a book that focuses and deeply explores one single topic – creating webbots.

In my opinion knowing how to create web bots is one of the most important web programmer skills, there is so much data on the internet that we need bots to take full adventage of the resources on the web and automate day to day boring online tasks. More over you will be surprised how often you will be asked on job interview if you can write a webbot. Continue reading Developing Webbots, Spiders and Screen Scrapers with PHP cURL

Clone keyword in PHP

A lot of people do not read PHP manual. That is a fact, they will look for answers to their questions on forums, books, blogs (like this one for example) and so on, while most of the answers they are looking for, are already there … in PHP manual. Or maybe it is me who is weired, because i like to browse to see “what’s new”, well can’t really tell. Continue reading Clone keyword in PHP