我正在使用 YQL 进行一些屏幕抓取,并且没有正确返回任何类似引号的字符。
例如,被抓取页面上的标记是:
There should not be a “split between what we think and what we do,”
这由 YQL 返回为:
There should not be a �split between what we think and what we do,�
这也发生在刻度和反刻度上。
我的 JS 是这样的:
var qurlString = '&url=' + encodeURIComponent(url);
$.ajax({
type: "POST",
url: "/k_sys/qurl.php",
datatype: "xml",
data: qurlString,
success: function(data) {
//do something
}
});
我的 qurl.php 就像:
$BASE_URL = "http://query.yahooapis.com/v1/public/yql";
$url = my scraped site url;
$yql_query = "select * from html where url='$url'";
$yql_query_url = $BASE_URL . "?q=" . urlencode($yql_query) . "&format=xml";
$session = curl_init($yql_query_url);
curl_setopt($session, CURLOPT_RETURNTRANSFER,true);
$xml = curl_exec($session);
echo $xml;
这是 cURL 问题还是 YQL 问题,我需要做些什么来解决它?
谢谢!