Tamamlanmış

Problems with encode of files PHP

To reproduce the problem, I attached 2 files:

======

My objetive is extract data of the file [login to view URL] with xpath of PHP

======

- [login to view URL] (no touch, no edit, it is IMPORTANT)

- [login to view URL] (you can work here)

<?php

$html =file_get_contents("[login to view URL]");

$dom = new \DOMDocument();

@$dom->loadHTML((string) $html);

$xpath = new \DOMXPath($dom);

$title = $xpath->query('//h3[@class="tb-main-title"]');

if(count($title)>0){

print_r($title[0]->nodeValue); // out 小米 红米S2蝴蝶花镜子皮套手机壳 红米Y2插卡全包防摔保护套男女

}

If u execute the last code all is okay....

=========

- BUT if you switch to file_get_contents("[login to view URL]") it not work.

- why, (if the content is same)?

- Ok, a clue.

- remove your file [login to view URL] of ur computer and copy [login to view URL] (linux/mac: cp [login to view URL] [login to view URL])

- now u have a again your file [login to view URL] switch to file_get_contents("[login to view URL]")

- not work right?

- with ur code editor (phpStorm, Netbeans, etc) add or remove any thing. Example, you go to the line #1 and give an Enter (new line empty)

- Now all work okay again

- Why? well, this is the problem...

- I think is any related with file encode, I think when we edit the file [login to view URL] with a code editor (ex. phpStorm) this editor add a special encode (and correct).

check:

==========

[root@65be04194cde wse-back]# file src/Demiurgo/Taobao/Items/Crawler/[login to view URL]

src/Demiurgo/Taobao/Items/Crawler/[login to view URL]: HTML document, ISO-8859 text, with very long lines

[root@65be04194cde wse-back]# file src/Demiurgo/Taobao/Items/Crawler/[login to view URL]

src/Demiurgo/Taobao/Items/Crawler/[login to view URL]: HTML document, Non-ISO extended-ASCII text, with very long lines, with CRLF, LF line terminators

Beceriler: Linux, PHP, Scrapy, Web Crawling

Daha fazlasını gör: to â € ™, ã â â, php encoding

İşveren Hakkında:
( 5 değerlendirme ) Guadalajara, Mexico

Proje NO: #18814291

Seçilen:

programdev0001

Hi, Sir!! I am a new freelancer. You may doubt me because I have white history. BUT I have rich experience about PHP, html, SQL and etc.. i have been read your description carefully and i can do it wonderfully. I h Daha Fazla

1 gün içinde %selectedBids___i_sum_sub_4%%project_currencyDetails_sign_sub_5% USD
(0 Değerlendirme)
0.0

Bu iş için 3 freelancer ortalamada $26 teklif veriyor

bhaskarmandal

Hi, I am 5 years experienced web developer. I understand your point. I can complete this project within two hours . Please check my profile for my work quality . Thanks, Bhaskar Mandal

$30 USD in 0 gün içinde
(84 Değerlendirme)
6.1
arindampr

I have 2+year experience in PHP-MY SQL, I am interested about this job because I have team to handle this project carefully, so discuss more about this project massage me.

$35 USD in 10 gün içinde
(1 Yorum)
2.4