Re: Posting form variables with http authentication
| From: | Rasmus Lerdorf | Date: | Fri, 22 Jun 2001 00:06:22 +0000 |
| Subject: | Re: Posting form variables with http authentication | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-54820@lists.php.net to get a copy of this message | ||
> This question is almost certainly an RTFM but I can't find it so I am going
> to ask anyway.
>
> I have a form on my ssl which I need to submit to a perl handler on another
> server. Problem is the company on the other side is requiring a http
> authentication to submit the form.
>
> I can't think of any way to send the authentication headers along with the
> form post. Perhaps I just don't know enough about that area. I was thinking
> that perhaps I could build a handler page on my server to take the original
> submission via post then send another post via PHP along with the headers
> needed for authentication.
>
> Before I even try this I was wondering if someone out there had ever done
> this or could point me in the right direction of some documentation in this
> area. If it can't be done I would appreciate knowing that as well.
You can do this with curl.
curl_setopt ($ch,CURLOPT_CUSTOMREQUEST , $req);
where $req contains your custom POST request which can include your
Authentication header which is simply base64_encode("username:password")
-Rasmus