Re: HTTP_Request not making HTTPS requests
| From: | Justin Patrin | Date: | Mon, 09 Aug 2004 14:44:54 +0000 |
| Subject: | Re: HTTP_Request not making HTTPS requests | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-14019@lists.php.net to get a copy of this message | ||
On Sun, 08 Aug 2004 14:02:24 +0100, R C Lacy-Hulbert
<chris@spiration.co.uk> wrote:
> HI all
>
> I'm having problems making an https request using PEAR's HTTP_Request. I
> have ssl support built in (--with-ssl) and I'm pointing a request at
> https://mysite.com:443/?action..etc however I still get
> "Bad Request"
> errors. I have also tried doing this without specifying the port no
> (443).
>
> The code I'm using looks something like this:
>
> $location=$toolkit_method."://".$toolkit_server.":443/";
> // set up the request
> $action="?action=context.new&u=christo&p=xxxxx";
> $request=$location.$action;
> $req = &new HTTP_Request($requiest);
> $req->setMethod(HTTP_REQUEST_METHOD_GET);
> $req->sendRequest();
>
> $res = $req-> sendRequest();
> echo "res is $res";
> if (PEAR::isError($res)) {
> die($res-> getMessage());
> }
>
> $response = $req->getResponseBody();
>
> The returned error looks kinda like this:
>
> -----
> Bad Request
> Your browser sent a request that this server could not understand.
>
> Reason: You're speaking plain HTTP to an SSL-enabled server port.
> Instead use the HTTPS scheme to access this URL, please.
>
> Hint: https://mysite.com:443/
>
> ________________________________________________________________________
> Apache/1.3.31 Server at mysite.com Port 443
> -----
>
> I have googled and searched the list archives and looked at the
> HTTP/Request.php sources, but can't figure out why this isn't working.
> Anybody got any ideas?
>
It looks like you're using the port, but not using https:// in your
URL. Since we can't see what $toolkit_method has in it, I can't say
whether this is the problem, though. If you specify https://, you
don't need the port as HTTP_Request will automatically use the default
HTTPS port. Try putting an "echo $request;" in to make sure that the
protocol is https.
> Many thanks
>
> christo
>
--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder
paperCrane --Justin Patrin--