我正在尝试使用雅虎的内容分析,从这里看起来真的很容易使用
但是每当我执行我的代码时,我都会得到以下输出:
Italian sculptors the Virgin Mary painters http://en.wikipedia.com/wiki/Painting http://en.wikipedia.com/wiki/Adobe_Photoshop http://en.wikipedia.com/wiki/Still_life http://en.wikipedia.com/wiki/Avant-garde http://en.wikipedia.com/wiki/In_the_Sky http://en.wikipedia.com/wiki/Potato 1
我想要的是看到一个带有 XML 标记的 XML 文档,就像单击此链接时它的显示方式一样
此外,我看到的输出的源代码(来自浏览器..右键单击>查看源代码)是:
<?xml version="1.0" encoding="UTF-8"?>
<query xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" yahoo:count="1" yahoo:created="2012-11-24T05:54:55Z" yahoo:lang="en-US"><results><entities xmlns="urn:yahoo:cap">
<entity score="0.784327">
<text end="16" endchar="16" start="0" startchar="0">Italian sculptors</text>
</entity>
<entity score="0.78097">
<text end="72" endchar="72" start="58" startchar="58">the Virgin Mary</text>
</entity>
<entity score="0.509566">
<text end="29" endchar="29" start="22" startchar="22">painters</text>
<wiki_url>http://en.wikipedia.com/wiki/Painting</wiki_url>
<related_entities>
<wikipedia>
<wiki_url>http://en.wikipedia.com/wiki/Adobe_Photoshop</wiki_url>
<wiki_url>http://en.wikipedia.com/wiki/Still_life</wiki_url>
<wiki_url>http://en.wikipedia.com/wiki/Avant-garde</wiki_url>
<wiki_url>http://en.wikipedia.com/wiki/In_the_Sky</wiki_url>
<wiki_url>http://en.wikipedia.com/wiki/Potato</wiki_url>
</wikipedia>
</related_entities>
</entity>
</entities></results></query><!-- total: 191 -->
<!-- engine6.yql.ac4.yahoo.com -->
1
以下是我的代码:
<?php
$c = curl_init();
curl_setopt($c, CURLOPT_URL, 'http://query.yahooapis.com/v1/public/yql');
curl_setopt($c, CURLOPT_POST, true);
curl_setopt($c, CURLOPT_POSTFIELDS, "q=select * from contentanalysis.analyze where text='Italian sculptors and painters of the renaissance favored the Virgin Mary for inspiration';");
curl_setopt($c,CURLOPT_HEADER,0);
$op=curl_exec ($c);
curl_close ($c);
echo $op;
?>