Oct 31, 2009

Tag Cloud - How to...

This post will explain how to implement a tag cloud onto your website:
For our group project, we planned to implement a tag cloud on website. We decided for the API of http://www.semager.de/.
At first, we used the proxy to create a request on their server:
$uri = 'www.semager.de/api/tagcloud.php?url=http://people.emich.edu/jabbouda/project/3/index.htm 


The result confused us. The semager-server has not processed the content, displayed on our website. Well, sure. It just processes the information that it founds on the website (without any content which was generated from our scripts).
The problem we had to solve was to save the generated data in a file, but how?
The answer is PHP:
$file=fopen("ebay.xml","w+");
// $file is the file handler. ebay.xml the filename,
// "w+" describes that we want to read and write the
// file, and that it deletes the content of an
// existing file or creates a new file, in the case
// there not such a file

fwrite($file,$xml);
// writes the content fo $xml into the file.
// $xml is the result that we got from the ebay server

fclose($file);
// closes the file after working on that
//

We changed our ebay-proxy file and inserted the lines above. The result is that the xml data that we receive is saved in the file: ebay.xml, on the server.
You have to know that the people.emich.edu does not allow creating / saving by PHP commands. This is the reason why we moved our project to:
http://www.highspeed-karlsruhe.de/cms/tmp/install_4a7adbd79d4d2/is449/

We changed the link in proxy file for the tag cloud and now we receive ready converted html data. This is displayed in the div tag.
Usually you must be able to get this running on your local XAMPP server.

4 comments:

  1. Well, I didn't know that our people site doesn't allow you to write php. I was planning to re-write the proxy file on the fly or, somehow pass a url varible into my proxy file. I would like to do multiple requests to different urls. It's good to know that our site may have problems. I could imagine spending a lot of time trying to figure that out. Thanks.

    ReplyDelete
  2. Implementing some of these web service API's is causing me a lot of confusion also. Php is another area where I need more understanding. Your post has been helpful.

    ReplyDelete
  3. This was very helpful information for me. For a long time i have considered implementing a cloud tag on my guilds forum site so that guests could quickly view running discussions.

    ReplyDelete
  4. Se você estiver procurando mais informações sobre o serralheiro de taxa fixa de Las Vegas, verifique isso imediatamente. aplicativo para ver sms de outro celular

    ReplyDelete