Implementing Vanity URLs in PHP w/ Zend Framework

One of the reasons why people like vanity url’s is because they are easy to remember. For example take the following url:

http://www.somesocialsite.com/?user_id=123456789&page=somepage

If this was the url to my page in some social network site, there’s no way I could remember it nor would I be able to easily share the url with others unless I sent them the link. Now, if I could instead create a vanity url that looked like the following:

http://www.somesocialsite.com/joeyrivera

it would be much easier to remember and to share with others. Not only that but now I have a much more search engine friendly url with keywords that I would like to be found under – but ignore the search engine benefits for now.

Why

I’m currently working on an application that can benefit from vanity urls for the reasons mentioned above so I decided to spend some time thinking of ways to implement this. The first way that came to my mind was using mod_rewrite. Mod rewrite lets you manipulate urls. For example, you can write rules in your .htaccess file so when a user goes to http://www.somesocialsite.com/joeyrivera it really calls http://www.somesocialsite.com/search.php?user=joeyrivera or in zend the request would be more like http://www.somesocialsite.com/search/user/name/joeyrivera Continue reading “Implementing Vanity URLs in PHP w/ Zend Framework”

AMF,XMLRPC,JSON,REST Zend Web Services Tutorial

I’ve been using the Zend for the last few months and I’m loving it. Here at work we were having a discussion about implementing some web services in the future so I decided to see what it takes to create some web services in PHP using Zend. I was pleasantly surprise (well not really surprised) that it was extremely quick and easy to get things up and running.

In this post, I’m going to explain how to create web services that can be accessed via AMF, XMLRPC, JSON, and REST using the Zend Framework. Hopefully these should cover most uses out there. I left SOAP out since I don’t really see myself using it any time soon. I will be communicating with a database as well to make the tutorial more informative. The db will consist of one table with information about courses such as mathematics courses.

I’m going to show you the final product first, hopefully to catch your attention so you’ll read the rest :). This is what the final product will look like. If you look at the following links in Chrome, do a view source to see the formatted response.

XMLRPC

One course:  http://www.joeyrivera.com/ZendWebServices/xml-rpc/course-info/abbr/math101/
All courses:  http://www.joeyrivera.com/ZendWebServices/xml-rpc/courses-info/

JSON

One course:  http://www.joeyrivera.com/ZendWebServices/json/course-info/abbr/math101/
All courses: http://www.joeyrivera.com/ZendWebServices/json/courses-info/

REST

One course:  http://www.joeyrivera.com/ZendWebServices/rest/course-info/?method=getCourseInfo&abbr=math102
All courses:  http://www.joeyrivera.com/ZendWebServices/rest/courses-info/?method=getCoursesInfo

AMF

One course:  http://www.joeyrivera.com/ZendWebServices/amf/course-info/abbr/math101
All courses:  http://www.joeyrivera.com/ZendWebServices/amf/courses-info/ Continue reading “AMF,XMLRPC,JSON,REST Zend Web Services Tutorial”