Home » Web Development » PHP »
PHP plugin autoload
Somewhere in the past i already covered autoloading on this blog but lately while developing my WordPress Job Board Plugin i decided to add an autoloader (there are over 30 libraries right now so it makes at least some sense), besides if we are given some cool tools why not to use them, right?
Posted in PHPBy Greg
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.
Posted in PHP, XMLBy Greg
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.
By Greg
PHP string to hex and hex to string functions
In my opinion SQL injection is an major issue when it comes to web application development. Typically programmers deal with it by escaping strings, while this is probably the best way to get it handled i want to show you different yet effective approach to this problem – converting string to hex value.
Posted in PHPBy Greg
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 (http://some-random-url.com/pages/page.html) or relative URL (pages/page.html)
By Greg
Detecting search engine bots with PHP
I have to admit i am writing this post because i will publish soon big article about cURL extension and show you how to use it to create bots which would be even able to login to web pages and do some actions there, actually nothing illegal, but still i fill the need to tell you how to detect “good” (search engine bots) and “bad” (scrappers) bots and how to protect from them.
Posted in PHPBy Greg
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 PHP.net to see “what’s new”, well can’t really tell.
Posted in PHPBy Greg
PHP, JSON and JavaScript usage
Today i want to introduce you to jSON (JavaScript Object Notation), in short, it is a simple format designed to exchange data between different programming languages. I will show you how to create JavaScript object, convert it to JSON string, and send to PHP script, which will decode jSON string to readable format (for PHP). But that’s not all, PHP script will create it’s own data object encode it to jSON string and send it back. All communication between JavaScript and PHP will be done thru AJAX.
Posted in Ajax, PHPBy Greg
Clean input variable PHP
Some time ago i wrote a post about query string and i think i pretty well covered that topic, however i didn’t mentioned one thing … cleaning input variables. In fact it is much more important to know how to clean $_POST and $_GET arrays then know how to handle query string, because variables sent by user are the only way to hack your script, it is that simple, if you take care of input variables then your script is 100% safe.
Posted in PHPBy Greg
Using PHP cURL to read RSS feed XML
I very rearly, use feeds, i prefer to go to my favourite website and see what is going on instead of downloading their content to my computer with some RSS reader. However the fact is feeds are getting popular and people are searching for a ways to access and easily automatically parse those feeds with PHP, and because RSS and ATOM are nothing more then XML documents then i have for you really simple way of handling those feeds which i want to share with you (thru my blog as well thru my blog feeds
).
By Greg


