O
O
Oleg2017-08-16 23:30:37
PHP
Oleg, 2017-08-16 23:30:37

Can you help with PHPquery encoding?

Colleagues. Help...

<?php
require 'phpQuery.php';
$omaURL = file_get_contents('https://www.oma.by/catalog/');
$omaParse = phpQuery::newDocument($omaURL);
$hentry = $omaParse->find('.page-main');
echo $hentry;

I get a crooked coding.
Moreover, if you parse the toaster
require 'phpQuery.php';
$omaURL = file_get_contents('https://toster.ru/');
$omaParse = phpQuery::newDocument($omaURL);
echo $omaParse;

That's all good.
File in utf-8;

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
artem78, 2017-08-17
@politon

Try manually specifying the encoding in the second parameter:
This trick may also help:

$omaParse = phpQuery::newDocument('<meta charset="utf-8">' . $omaURL);

I
Ilya, 2017-08-16
@glebovgin

There is a suspicion that the matter is in a crooked meta on the donor
There are extra single quotes. Try replacing charset='UTF-8' with charset=UTF-8
after file_get_contents

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question