无法使用 simplexml 或 xmldom 访问 Google Analytics 响应 xml 的 xml 条目
我正在使用curl 访问谷歌分析数据。
其响应文本包含如下内容。
<entry gd:etag='W/"A0EEQX47eSp7I2A9WhZSFU8."' gd:kind='analytics#datarow'>
<id>http://www.google.com/analytics/feeds/data?ids=ga:176&ga:pagePath=/indian-language-unicode-converter/punjabi-unicode-converter.html&start-date=2011-03-01&end-date=2011-03-31</id>
<updated>2011-03-30T17:00:00.001-07:00</updated>
<title>ga:pagePath=/indian-language-unicode-converter/punjabi-unicode-converter.html</title>
<link rel='alternate' type='text/html' href='http://www.google.com/analytics'/>
<dxp:dimension name='ga:pagePath' value='/indian-language-unicode-converter/punjabi-unicode-converter.html'/>
<dxp:metric confidenceInterval='0.0' name='ga:pageviews' type='integer' value='1131'/>
</entry>
<entry gd:etag='W/"A0EEQX47eSp7I2A9WhZSFU8."' gd:kind='analytics#datarow'>
<id>http://www.google.com/analytics/feeds/data?ids=ga:76&ga:pagePath=/indian-language-unicode-converter/hindi-unicode-converter.html&start-date=2011-03-01&end-date=2011-03-31</id>
<updated>2011-03-30T17:00:00.001-07:00</updated>
<title>ga:pagePath=/indian-language-unicode-converter/hindi-unicode-converter.html</title>
<link rel='alternate' type='text/html' href='http://www.google.com/analytics'/>
<dxp:dimension name='ga:pagePath' value='/indian-language-unicode-converter/hindi-unicode-converter.html'/>
<dxp:metric confidenceInterval='0.0' name='ga:pageviews' type='integer' value='974'/>
</entry>
在上面我想访问
我尝试使用 simplexml 和 phpdomxml 使用 getglementsbytagname 但仍然无法到达该节点。
如果有人可以帮助我,那就太好了..只是逻辑..
此外 xml dxp:dimension 中的这个符号是什么?
I am accessing the google analytics data using curl.
Its response text contains some thing like the following.
<entry gd:etag='W/"A0EEQX47eSp7I2A9WhZSFU8."' gd:kind='analytics#datarow'>
<id>http://www.google.com/analytics/feeds/data?ids=ga:176&ga:pagePath=/indian-language-unicode-converter/punjabi-unicode-converter.html&start-date=2011-03-01&end-date=2011-03-31</id>
<updated>2011-03-30T17:00:00.001-07:00</updated>
<title>ga:pagePath=/indian-language-unicode-converter/punjabi-unicode-converter.html</title>
<link rel='alternate' type='text/html' href='http://www.google.com/analytics'/>
<dxp:dimension name='ga:pagePath' value='/indian-language-unicode-converter/punjabi-unicode-converter.html'/>
<dxp:metric confidenceInterval='0.0' name='ga:pageviews' type='integer' value='1131'/>
</entry>
<entry gd:etag='W/"A0EEQX47eSp7I2A9WhZSFU8."' gd:kind='analytics#datarow'>
<id>http://www.google.com/analytics/feeds/data?ids=ga:76&ga:pagePath=/indian-language-unicode-converter/hindi-unicode-converter.html&start-date=2011-03-01&end-date=2011-03-31</id>
<updated>2011-03-30T17:00:00.001-07:00</updated>
<title>ga:pagePath=/indian-language-unicode-converter/hindi-unicode-converter.html</title>
<link rel='alternate' type='text/html' href='http://www.google.com/analytics'/>
<dxp:dimension name='ga:pagePath' value='/indian-language-unicode-converter/hindi-unicode-converter.html'/>
<dxp:metric confidenceInterval='0.0' name='ga:pageviews' type='integer' value='974'/>
</entry>
in the above i want to access the <dxp:dimension and <dxp:metric
I tried using simplexml and phpdomxml using getglementsbytagname but still i couldnt reach that node.
if somebody could help me with that then that would be nice.. just the logic..
and besides what is this notation in xml dxp:dimension ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
dxp:是一个命名空间。更多说明请参见:dxp 命名空间results xml feed
如果您使用 PHP,您可以尝试类似的功能:
Alex Curelea 的以下帖子非常有帮助:使用 Google Analytics API - 获取总计页面浏览量
dxp: is a namespace. More explanation can be found here: dxp namespace in the results xml feed
If you are using PHP, you could try a function similar to this:
And the following post by Alex Curelea is very helpful: Using the Google Analytics API - getting total number of page views