Reputation: 10211
My question is that how can we save some html page for given url.. like if I will put the url "http://www.google.com/" then how we will save this page as html on server via php... the purpose is to read that page with utf-8 charset.. the current charset is windows-1255.. and I want to change the chrset to utf-8 or if there is any option to read that page with current charset when there is some other language in that page...
Actually I wana read the contents after search done.. of this page "http://elyon1.court.gov.il/verdictssearch/HebrewVerdictsSearch.aspx"
If there is any solution....
I m using PHP for serverside language..
Upvotes: 2
Views: 3421
Reputation: 8509
// this is 'windows-1251' encoded page
$remote_page = 'http://www.gramota.ru/';
$doc = file_get_contents($remote_page);
// to get 'UTF-8' encoded content
$docutf8 = mb_convert_encoding($doc, 'UTF-8', 'windows-1251');
to show original document in original encoding (windows-1251
)...
header('Content-Type: text/html; charset=windows-1251');
echo $doc;
to show original document in UTF-8
encoding (converted from windows-1251
)...
header('Content-Type: text/html; charset=utf-8');
echo $docutf8;
Upvotes: 0
Reputation: 5052
You can save the contents with file_get_contents:
$page = file_get_contents('http://elyon1.court.gov.il/verdictssearch/HebrewVerdictsSearch.aspx');
And then convert the charset with iconv:
$converted_page = iconv('windows-1252','utf-8',$page);
Upvotes: 3