Webpages as Graphs

With this funny applet, you can judge of the complexity of a web page by just generating it’s graph! my homepage is way too complex compare to google for example :-)


What do the colors mean?
blue: for links (the A tag)
red: for tables (TABLE, TR and TD tags)
green: for the DIV tag
violet: for images (the IMG tag)
yellow: for forms (FORM, INPUT, TEXTAREA, SELECT and OPTION tags)
orange: for linebreaks and blockquotes (BR, P, and BLOCKQUOTE tags)
black: the HTML tag, the root node
gray: all other tags

Nothing new some of you will cry, as this java applet is available since 2007.. Yes but..

The main difference, is that I provide you the last bit of code to make it work on your own server, or locally in any php environment. The magic part that is difficult to get is the function that retrieve the html content of any page and pass it to the applet.

For this task and since on some web host, the php function furlopen() may be forbidden (I recommend you to disable it to reduce backdoor inclusion), i will present you a solution with CURL

PHP supports libcurl, a library created by Daniel Stenberg, that allows you to connect and communicate to many different types of servers with many different types of protocols. libcurl currently supports the http, https, ftp, gopher, telnet, dict, file, and ldap protocols. libcurl also supports HTTPS certificates, HTTP POST, HTTP PUT, FTP uploading (this can also be done with PHP's ftp extension), HTTP form based upload, proxies, cookies, and user+password authentication. [PHP Manual]&160;

So I’ve create a small script call display.php that return the content of a webpage

Get Data From URL With Curl


$input = $_GET;
$name = 'url';
$url = (isset($input[$name]) && 
$input[$name] !== null) ? $input[$name] :
"http://www.waltercedric.com"; $timeout = 10; $show_errors = true; if (function_exists('curl_init')) { return getDataFromUrlWithCurl($url, $timeout, $show_errors); } else { return getDataFromUrlWithFopen($url, $timeout); } /** * CURL function to retrieve data from a URL. */ function getDataFromUrlWithCurl($url, $timeout = 10, $show_errors = false) { $ch = curl_init(); $agent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"; curl_setopt($ch, CURLOPT_USERAGENT, $agent); curl_setopt ($ch, CURLOPT_HEADER, 0); curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_HTTPGET,1); curl_setopt($ch,CURLOPT_CRLF,1); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); // so it will return data into a
                                              //variable instead of printing out
   curl_setopt($ch,CURLOPT_TIMEOUT,$timeout); // give it a time in seconds to reply
   //curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, false); //dont validate SSL cert
   $result = curl_exec($ch);

   if ($show_errors && curl_error($ch)) {
      printf("Curl error %s: %s", curl_errno($ch), curl_error($ch));
      print(' <a href="' . $url . '" target="_blank">This is the url</a><br>');


You can look at all CURL options there: http://us2.php.net/curl_setopt

Get the source code to make your own site

Download now

All credits to original author

About the author (Sala) of this applet



Make a screenshot of your sitegraph below, put it on flickr and tag it websitesasgraphs.

You might like also

PuTTYCS - PuTTY Command Sender 1.8.1
PuTTYCS is a small windows application that is intended to be used along with multiple instances of PuTTY (including PuTTYtel, TuTTY, and PieTTY). It's purpose is to send the same command to each PuTTY window. It is can be useful for copying files, starting and stopping processes, and examining logs on multiple servers. If you're not familiar with PuTTY, then this tool is probably not for you. If you want to find out more about PuTTY, visit PuTTY at http://www.chiark.greenend.org.uk/~sgtatham/putty …
1732 Days ago
Search And Replace Within Zip Files with Regular Expressions
There is a lot of shareware and freeware (jEdit, Notepad++) to do complex search and replacement in files but none is supporting these kind of operations in zip files spread across many subdirectories. Luckily Oxygen Editor can Do case sensitive or insensitive searches, Search and replace across multiple files in multiple subdirectories, Search and replace also in ZIP files, Advanced regular expression search/replace, Is free to evaluate for 30 days! Use the Menu "Find" and select "Replace in Files" or …
2946 Days ago
The Build Tool Report: Turnaround Times using Ant, Maven, Eclipse, IntelliJ, and NetBeans
          Even if the sample is quite small (600 responses), it still interesting going through these compiled data Some time ago we ran a survey asking a few questions about the build process, specifically the tools that are used to do incremental builds and how much time those builds take. We had over 600 responses, so now it’s time to count the results. This is the first time that we’ve published results on the incremental build …
3771 Days ago
How to check commit comments on SVN Commit
If you are using Subversion/CVS, you might have come across the issue where multiple developers working on a set of files are committing without any comments. Subversion’s hook scripts provide a powerful way to associate actions with repository events. For example, the pre-commit hook allows you to check — and possibly abort — a transaction before it actually gets committed. I will provide you now two easy Unix bash scripts  that avoid bad developer behaviors: The first one “checkCommentNotEmpty.sh” is …
3775 Days ago
Atlassian just acquired GreenHopper
Atlassian just acquired GreenHopper, a popular JIRA plugin with over 800 customers. GreenHopper is a JIRA plug-in that adds a broad collection of agile project management capabilities to JIRA, and extends JIRA as a powerful platform for agile development teams. GreenHopper simplifies the planning and organization of tasks, workflows and reporting for agile teams. It introduce in JIRA Card management:  Visualise issues, tasks and user stories as graphical "cards", color-coded and dynamically editable. Planning Board: Quickly create, assemble, sort and …
3920 Days ago
No Thumbnail was found
Keyboard ShortcutsFilesControl-NNew file.Control-OOpen file.Control-WClose buffer.Control-E Control-WClose all buffers.Control-SSave buffer.Control-E Control-SSave all buffers.Control-PPrint buffer.Control-Page UpGo to previous buffer.Control-Page DownGo to next buffer.Control-`Go to recent buffer.Control-QExit jEdit.ViewsControl-E Control-TTurn gutter (line numbering) on and off.Control-2Split view horizontally.Control-3Split view vertically.Control-1Unsplit.Alt-Page UpSend keyboard focus to previous text area.Alt-Page DownSend keyboard focus to next text area.Control-E Control-Up; Control-Left; Control-Down; Control-RightSend keyboard focus to top; bottom; left; right docking area.Control-E Control-`Close currently focused docking area.Control-E Control-ESend keyboard focus back to current text area.RepeatingControl-EnternumbercommandRepeat the command (it can …
5330 Days ago
No Thumbnail was found
"For more than 50 years software has been a troublesome discipline. Software's problems are numerous and include cancelations, litigation, cost overruns, schedule overruns, high maintenance costs, and low levels of user satisfaction. The problems with software occur more often than not. My company's research indicates that more than half of large software projects will encounter some kind of delay, overrun, or failure to perform when deployed. But software does not have to be as troublesome as it has been. …
5572 Days ago
No Thumbnail was found
TCPviewer dsplay TCP connections in realtime and ProcessXP shows all processes and their dependant dll loaded into memory... GIMP www.gimp.org can replace photoshop, open source free, it can replace any graphic editor TCP proxy is a tool part of Soap AXIS, useful to show SOAP request and response or any process using TCP connection. Jedit, the BEST text editor ever written!!!! Beyond Compare for comparing directories, files. Do a lot of things, you will never forget this name!!!! …
5638 Days ago