我正在使用YQL進行某些屏幕抓取,並且沒有正確返回任何類似引號的字符。YQL和cURL - 引用字符沒有正確返回
例如,頁面被刮上的標記是:
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;
這是捲曲的問題或YQL問題,以及我需要做些什麼來解決什麼它?
謝謝!