Index: trunk/extensions/MetricsReporting/fetchGoogleSpreadsheet.php |
— | — | @@ -44,7 +44,7 @@ |
45 | 45 | if ( $authToken === null ) { |
46 | 46 | $this->error( 'No auth token returned. Check your Google Credentials', true ); |
47 | 47 | } |
48 | | - $this->output( 'Authorised. Got an authorisation token from Google' ); |
| 48 | + $this->output( "Authorised. Got an authorisation token from Google\n" ); |
49 | 49 | |
50 | 50 | $cookies = $http->getCookieJar(); |
51 | 51 | //var_dump( $cookies ); |
— | — | @@ -62,7 +62,27 @@ |
63 | 63 | //var_dump( $res ); |
64 | 64 | //var_dump( $http->getResponseHeaders() ); |
65 | 65 | $content = $http->getContent(); |
66 | | - var_dump( $this->formatXmlString( $content ) ); |
| 66 | + //var_dump( $this->formatXmlString( $content ) ); |
| 67 | + |
| 68 | + $reader = new XMLReader(); |
| 69 | + $reader->XML( $content ); |
| 70 | + |
| 71 | + while ( $reader->read() && $reader->name !== 'entry' ); |
| 72 | + |
| 73 | + $worksheets = array(); |
| 74 | + while ( $reader->name === 'entry' ) { |
| 75 | + |
| 76 | + $node = new SimpleXMLElement( $reader->readOuterXML() ); |
| 77 | + |
| 78 | + $src = (string)$node->content["src"]; |
| 79 | + $this->output( 'Worksheet found: ' . $src ); |
| 80 | + $worksheets[] = $src; |
| 81 | + |
| 82 | + // go to next <entry /> |
| 83 | + $reader->next( 'entry' ); |
| 84 | + } |
| 85 | + |
| 86 | + $this->output( "Finished!\n" ); |
67 | 87 | } |
68 | 88 | |
69 | 89 | /** |