[PEAR] How to Set Proxy Information with setProxy in Services_Amazon

Tadashi Shigeoka ·  Wed, November 16, 2011

An error occurred when using PEAR’s Services_Amazon class.  

■ Error details

Amazonの情報取得に失敗しました(HTTP_Request::sendRequest failed: Malformed response)
Failed to retrieve Amazon information (HTTP_Request::sendRequest failed: Malformed response)

The cause was using an authenticated proxy.

Therefore, you need to set the proxy information using the Services_Amazon class’s setProxy method.

$amazon = new Services_Amazon($access_key_id, $secret_access_key);
$amazon->setProxy($host, $port, $user, $pass);

The following is quoted from the Services_Amazon manual:

setProxy

void setProxy( string $host, [int $port = 8080], [string $user = null], [string $pass = null])

Sets a proxy Access: public

Parameters:

string $host — Proxy host int $port — Proxy port string $user — Proxy username string $pass — Proxy password

[Source]: Docs For Class Services_Amazon

That’s all from the Gemba.