Re: Another issue with HTTP_Request

From: Date: Fri, 02 Jan 2009 17:15:11 +0000
Subject: Re: Another issue with HTTP_Request
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-29554@lists.php.net to get a copy of this message
Brook Rouge wrote:
Ok, so I downloaded the old version of HTTP_Request and Net_URL and now I don't get any errors opening the page. I tried to implement the Request and I get a blank page, maybe I am scripting this wrong. Here is my code: ini_set(
    "include_path", (
        "D:/hshome/bdcpdn/megasys.brooksdigital.com/PHP/lib" .
        PATH_SEPERATOR .
        ini_get("include_path")
        )
    );
include('D:/hshome/bdcpdn/megasys.brooksdigital.com/PHP/lib/HTTP/Request.php'); $req =& new HTTP_Request('http://alpha.lodgepro.com:8088/megaweb'); $req->addHeader("Content-Type", "text/xml"); $req->addHeader("Content-Length", strlen($XMLString)); $req->setMethod(HTTP_REQUEST_METHOD_POST); $req->addRawPostData($XMLString, true); $req->sendRequest(); echo $req->getResponseBody(); Shouldn't the last line print out the response from the XML database? The data in the $XMLString is as follows: <megaweb><header sysId="clientsvc" procId="" password="" mesgNum="090904555M" megaSystem="train" /><request reqCode="static" /></megaweb>
A blank page probably means a fatal error somewhere. Have you checked your error log? Also, try wrapping the last part with: $response = $req->sendRequest(); if (PEAR::isError($response)) { echo $response->getMessage(); //or echo $response->getUserInfo(); } else { echo $response->getResponseBody(); }

« previous php.pear.general (#29554) next »