Index: trunk/extensions/MetricsReporting/fetchGoogleSpreadsheet.php |
— | — | @@ -25,15 +25,14 @@ |
26 | 26 | ) |
27 | 27 | ) |
28 | 28 | ); |
| 29 | + $http->setHeader( 'User-Agent', self::getUserAgent() ); |
29 | 30 | |
30 | 31 | $res = $http->execute(); |
31 | 32 | if ( $http->getStatus() == 403 ) { |
32 | 33 | $this->error( '403', true ); |
33 | 34 | } |
34 | | - //var_dump( $res ); |
35 | | - //var_dump( $http->getResponseHeaders() ); |
| 35 | + |
36 | 36 | $content = $http->getContent(); |
37 | | - //var_dump( $content ); |
38 | 37 | |
39 | 38 | $authToken = null; |
40 | 39 | $pos = strpos( $content, 'Auth' ); |
— | — | @@ -62,7 +61,8 @@ |
63 | 62 | |
64 | 63 | $node = new SimpleXMLElement( $reader->readOuterXML() ); |
65 | 64 | |
66 | | - $src = (string)$node->content["src"]; |
| 65 | + //$src = (string)$node->content["src"]; |
| 66 | + $src = $node->content->attributes()->src; |
67 | 67 | $this->output( 'Worksheet found: ' . $src ); |
68 | 68 | $worksheets[] = $src; |
69 | 69 | |
— | — | @@ -103,9 +103,9 @@ |
104 | 104 | function buildAuthedRequest( $url, $token, $cookies = null ) { |
105 | 105 | $http = MWHttpRequest::factory( $url, array( |
106 | 106 | 'method' => 'GET', |
107 | | - 'source' => self::getUserAgent(), |
108 | 107 | ) |
109 | 108 | ); |
| 109 | + $http->setHeader( 'User-Agent', self::getUserAgent() ); |
110 | 110 | if ( $cookies !== null ) { |
111 | 111 | $http->setCookieJar( $cookies ); |
112 | 112 | } |