I've created a PHP library for the new Blogger API that uses the PEAR
HTTP Client and is compatible with PHP 4.

When I first released it a couple weeks ago, it worked fine with
Blogger beta accounts using the ClientLogin Interface.

Recently, however, the PEAR Client has begun returning a "Malformed
response" error when it posts a request with the Google server.

It worked at one time.  Anyone have any idea what's happeniing?

Here's my code:

        // Create PEAR Client
        $GDATA_CLIENT = new HTTP_Request($request_url, $_CONFIG);
        $GDATA_CLIENT->setMethod(HTTP_REQUEST_METHOD_POST);

        // Build Request
        $GDATA_CLIENT->addHeader('Content-type',
'application/x-www-form-urlencoded');
        $GDATA_CLIENT->addPostData('Email', $_BODY['Email']);
        $GDATA_CLIENT->addPostData('Passwd', $_BODY['Passwd']);
        $GDATA_CLIENT->addPostData('service', $_BODY['service']);
        $GDATA_CLIENT->addPostData('source', $_BODY['source']);

        // Send Request
        $GResult = $GDATA_CLIENT->sendRequest();

        // Check for Errors
        if ( PEAR::isError($GResult) )
        {
                $_dump = print_r($GDATA_CLIENT, 1);
                $_err = $GResult->getMessage();
                trigger_error("request failed: {$_err}<br /> Client Object Dump:
<pre>$_dump</pre>", E_USER_WARNING);
                return 0;
        }

        // Get Code and Body
        $_code = $GDATA_CLIENT->getResponseCode();
        $_code_class = floor($_code / 100);
        $_response = $GDATA_CLIENT->getResponseBody();


Here's a dump of the PEAR object:

http_request Object
(
    [_url] => net_url Object
        (
            [url] => https://www.google.com/accounts/ClientLogin
            [protocol] => https
            [username] =>
            [password] =>
            [host] => www.google.com
            [port] => 443
            [path] => /accounts/ClientLogin
            [querystring] => Array
                (
                )

            [anchor] =>
            [useBrackets] => 1
            [user] =>
            [pass] =>
        )

    [_method] => POST
    [_http] => 1.1
    [_requestHeaders] => Array
        (
            [Host] => www.google.com
            [User-Agent] => PEAR HTTP_Request class (
http://pear.php.net/ )
            [Connection] => close
            [Accept-Encoding] => gzip
            [Content-type] => application/x-www-form-urlencoded
            [Content-Type] => application/x-www-form-urlencoded
        )

    [_user] =>
    [_pass] =>
    [_sock] => in
C:\apache2triad\htdocs\GREQO_SVN\greqo\greqo_auth.lib.inc.php on line
128

Full code library is available here:
http://greqo.googlecode.com/svn/trunk/

Thanks,
Tom


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"Google Data API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to