Skip to content

Automatically convert to UTF-8, detecting based on header's charset and html meta charset.

Notifications You must be signed in to change notification settings

sasezaki/guzzle4-charset-subscriber

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

guzzle4-charset-subscriber

A bridge Diggin_Http_Charset & Guzzle4. enable auto convert charset encoding to UTF-8.

INSTALL

php composer.phar require sasezaki/diggin-guzzle4-charset-subscriber

USAGE

<?php

use GuzzleHttp\Client;
use DigginGuzzle4CharsetSubscriber\CharsetSubscriber;

require_once __DIR__.'./vendor/autoload.php';

$url = 'http://d.hatena.ne.jp/'; // euc-jp web-site

$client = new Client();
$client->getEmitter()->attach(new CharsetSubscriber);
$res = $client->get($url);

var_dump(strip_tags($res->getBody()->__toString())); // will be output as UTF-8

Guzzle3

If you looking for Guzzle3.

About

Automatically convert to UTF-8, detecting based on header's charset and html meta charset.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages