Log In
New Account
  
Home My Page Project Cloud Code Snippets Project Openings Hermes
Summary Lists News SCM
1 <?php
3 /*
4  * maemo.org user list - outputs a CSV file of all maemo.org user
5  * profiles for use in Hermes.
6  *
7  * Developed by slauwers for aflegg.
8  * Further modifications by Andrew Flegg.
9  *
10  * Copyright (c) Sebastian Lauwers 2010.
11  * Copyright (c) Andrew Flegg <andrew@bleb.org> 2010.
12  * Released under the Artistic Licence.
13  */
15 $BASE_URL = 'http://maemo.org/profile/list/?org_openpsa_qbpager_net_nehmer_account_list_page=';
17 for ($i = 1; $i < 250; $i++) {
18     $url = $BASE_URL.$i;
20     $doc = new DOMDocument();
21     @$doc->loadHTMLFile($url);
23     $table = $doc->getElementsByTagName('tbody');
24     $rows = $table->item(0)->childNodes;
26     if (!is_null($rows)) {
27         foreach ($rows as $row) {
28             $columns = $row->childNodes;
30             if (!is_null($columns)) {
31                 $img = $columns->item(0)->getElementsByTagName('img')->item(0);
32                 $img_url = $img->getAttribute('src');
33                 $img_url = $img_url == 'http://static.maemo.org/style_maemo2009/img/profile/default-icon.png' ? '' : $img_url;
35                 $element = $columns->item(2)->getElementsByTagName('a')->item(0);
36                 $username = $element->nodeValue;
37                 $user_url = $element->getAttribute('href');
39                 $fullname = trim($columns->item(4)->nodeValue);
41                 $title = trim($columns->item(6)->nodeValue);
43                 $karma = intval(trim($columns->item(8)->nodeValue));
45                 if ($fullname || $img_url)
46                     echo "$username,$fullname,http://maemo.org$user_url,$title,$karma,$img_url\n";
47             }
48         }       
49     }
50 }
51 ?>

Terms of Use    Privacy Policy    Contribution Guidelines    Feedback

Powered By GForge Collaborative Development Environment