The Developer Day | Staying Curious

Archive for June 2007

Jun/07

22

Free Online SEO Sitemap Crawler Tool

The company that I work for has a lot to do with SEO, SEM, PPC. There are such a thing as sitemaps and URL lists that are used in SEO for Search Engines to optimize your site easier and better.

We have a lot of sites which have some SEO development going on. To generate these URL lists is not a task for a human being to do and I didn’t want to develop a custom sitemap generator for each of our projects.

I have tried to search for a tool that could generate these URL lists given only a single root URL. It was a while ago so I cannot say that such tools don’t exist. I also like my tools to be simple and easily extended so I developed a tool of my own. It’s a simple crawler that only needs to know the start URL and the base URL and it can find all your URLs in no time. The tool remembers the pages it has already visited. So for example let’s say I wanted to know all my blog URL’s. I just feed the crawler two URLs and wait for the results. The tool also ignores any outside URLs and adds the base URL to relative links.

You can download the crawler or try it out for yourself.

Please read comments below if you are interested why the second input field is needed.

, , , , Hide

Jun/07

20

XML beautifier tool

This post describes a tool that I wrote long time ago. By now I have published a new refactored version of the XML beautifier which solves a few problems of the original tool.

I’m currently working with a system that is communicating with various third parties using web services. There are times when I need to view some of the XMLs or output them for some particular reason. Because of the last reason I wanted the beautifier to be written in PHP so that I could implement it easily. After spending some time googling with keywords like “php xml indent”, “php xml output”, “php xml human readable”, “php xml beautifier” I found that there are some code snippets or incomplete /not fully working classes / functions.

I’ve also tried pear.php.net and there indeed is a package named “XML Beautifier” that is no longer maintained. And I was frightened away by lot’s of dependencies: PEAR, XML Parser, XML Utilities, XML Beautifier .. Brrrr ..

Finally I visited phpclasses.org and found a class named “Beauty XML”. It’s simple, works but has a few bugs. So I modified the class to do the following things:

  • To ignore adding a new level after if finds a tag like <tag />
  • To remove all XML headers
  • To remove white spaces from situations like “</tag2> </tag1>”

You can download the beauty XML or try it out yourself.

I think there still may be some XMLs that don’t get indented nicely and if i don’t find out that myself maybe You will. So please tell me if you do. I’ve also added a simple interface file to view XMLs in your web browser.

Maybe you already have or know a tool that does this job perfectly and I would be happy if you shared this with me.

, , Hide

Jun/07

18

PHP5 upgrade - DLL & version issues

Recently I tried to update my PHP 5.2.0 version to 5.2.3 on my Windows XP machine. After the upgrade I found that phpinfo() would still show the previous version of PHP 5.2.0. Though running the “php -version” at the command line would work fine saying that my php version is 5.2.3. Later that day I also noticed that I’m unable to connect to MySQL.

Fatal Error: undefined function mysql_connect()

Though, running php -m at the command line would say, that mysql extension is ready and loaded. And phpinfo() would show it as not loaded. After checking apache’s logs/error.txt i found that php is unable to load quite a few of the php.ini enabled extensions.

PHP Warning: PHP Startup: Unable to load dynamic library ‘c:\\php\\ext\\php_curl.dll’ - The specified procedure could not be found.\r\n in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘c:\\php\\ext\\php_mcrypt.dll’ - The specified module could not be found.\r\n in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘c:\\php\\ext\\php_mhash.dll’ - The specified procedure could not be found.\r\n in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘c:\\php\\ext\\php_mysql.dll’ - The specified procedure could not be found.\r\n in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘c:\\php\\ext\\php_mysqli.dll’ - The specified procedure could not be found.\r\n in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘c:\\php\\ext\\php_soap.dll’ - The specified procedure could not be found.\r\n in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library ‘c:\\php\\ext\\php_xmlrpc.dll’ - The specified procedure could not be found.\r\n in Unknown on line 0

I started googling on the matter to find out what went wrong with the upgrade. After reading a PHP bug report I realized that it might have something to do with my windows/system32 dlls. Then I found php5ts.dll in the windows/system32 directory.

It became clear to me, that PHP CLI version was using the the DLL’s from the php directory and PHP as an Apache module was loading them from the windows\system32 directory. I deleted all of the DLLs that are in the PHP directory from the windows/system32 directory and added PHP directory path to PATH environment variable and everything seems to work fine now.

My personal advice is not to put any of PHP DLL’s in the windows/system32 directory. You may really forget you have them there and become confused why things have started acting strangely.

, Hide

Find it!

Theme Design by devolux.org