Using the WordPress HTTP_API (wp_remote_get) with GZiped data.
Posted
by Volmar
on Stack Overflow
See other posts from Stack Overflow
or by Volmar
Published on 2010-05-31T17:42:08Z
Indexed on
2010/05/31
17:43 UTC
Read the original article
Hit count: 306
Hi i working on a wordpress plugin where i'm getting data from a remote API. at irst i used cURL, but after reading this blogpost i started using WordPress HTTP_API instead. but i've got onw problem. The API answers are Gziped, and i havn't figured out how to decompress them. The Codex page is talking about an argument called decompress, but i've tried it in alot of ways but i don't get it right.
I used this code in cURL:
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_ENCODING, "gzip");
$result = curl_exec($curl);
curl_close($curl);
anyone knows a way to do the same thing with the HTTP_API?
© Stack Overflow or respective owner