테이블에서 내 제품의 이름을 가져오고 싶습니다.구문 분석 창문 - 1251 - utf - 8. 텍스트를 잡을 수 없다
하지만 키릴 문자로 이름을 붙잡을 수는 없습니다.
구문 분석을 위해 ganon을 사용하고 있습니다.
이름을 사용하여 배열을 출력하려고하면 키릴 문자를 포함해야하는 모든 값이 비어 있습니다. 왜?
제발 도와주세요. 이미 인코딩을 알고 있기 때문에
$url = "http://www.plati.ru/asp/block_goods_s.asp?id_r=0&id_s=252900&sort=name&page=1&rows=10&curr=EUR&lang=ru-RU&rnd=1544554";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/7.0");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 50);
$result = curl_exec($ch);
$redir = curl_getinfo($ch, CURLINFO_HEADER_OUT);
curl_close($ch);
$html = str_get_dom($result);
foreach ($html('.link_good_tab') as $element) {
$temp = str_replace("\xA0", ' ', $element->getPlainText());
$products[] = iconv(mb_detect_encoding($temp, mb_detect_order(), true), "UTF-8", $temp);
}
echo "<pre>";
print_r($products);
echo "</pre>";
이
이 결과[0] =>
[1] =>
[2] =>
[3] =>
[4] =>
[5] =>
[6] =>
[7] =>
[8] =>
[9] =>
[10] => C&C: Red Alert 3 - Uprising (Origin/RegFree/Multilang)
이미 알고있는'mb_detect_encoding'과 인코딩을 사용하지 마십시오. – sectus