일부 화면 스크래핑에 YQL을 사용하고 있으며 따옴표와 같은 문자가 제대로 반환되지 않습니다.YQL 및 cURL - 따옴표 문자가 제대로 반환되지 않습니다.
예를 들어, 스크랩 된 페이지의 마크 업입니다 :이 또한 진드기와 백 틱으로 발생
There should not be a �split between what we think and what we do,�
:
There should not be a “split between what we think and what we do,”
이 같이 YQL에 의해 반환됩니다.
var qurlString = '&url=' + encodeURIComponent(url);
$.ajax({
type: "POST",
url: "/k_sys/qurl.php",
datatype: "xml",
data: qurlString,
success: function(data) {
//do something
}
});
그리고 내 qurl.php 같은 것입니다 :
내 JS 같은입니다
$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 문제, 내가 해결하기 위해 필요한 것은 무엇인가 그것?
감사합니다.