Re: HTTP Authentication [ SOLVED ]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 19, 2008 at 12:47 PM, Thiago H. Pojda
<thiago.pojda@xxxxxxxxx> wrote:
> On Wed, Nov 19, 2008 at 12:15 PM, Andrew Ballard <aballard@xxxxxxxxx> wrote:
>>
>> On Wed, Nov 19, 2008 at 9:26 AM, Thiago H. Pojda <thiago.pojda@xxxxxxxxx>
>> wrote:
>> > Guys,
>> >
>> > I have to access a WS that uses HTTP auth directly with PHP.
>> >
>> > I've tried using the usual http://user:pw@xxxxxxxxxxx/ but I couldn't
>> > get it
>> > working. I believe it has something to do with the password containing a
>> > #
>> > (can't change it) and the browser thinks it's an achor or something.
>> >
>> > All I've seen were scripts to implement HTTP Auth in PHP, nothing about
>> > actually logging in with PHP.
>> >
>> > Is it possible to send the authentication headers the first time I
>> > access
>> > the link? I could send all necessary headers to the page I'm trying to
>> > access and retrieve it's content at once.
>> >
>> >
>> > Thanks,
>> > --
>> > Thiago Henrique Pojda
>> >
>>
>> You're passing the username and password as part of a URL, so
>> shouldn't the username and password be urlencoded? I'm thinking it
>> will work if you replace the '#' sign with %23.
>>
>> Andrew
>
> I only tried thworing urlencode on everything, which obviously didn't work.
>
> Both ways worked, using %23 for '#' and the snippet from Nathan.
>
>
> Thanks a lot everyone, I was about to build all the headers and stuff :P
>
> Regards,
> --
> Thiago Henrique Pojda
>

Yes. If you go that route, you have to separately urlencode each piece
of data rather than the whole URL because you don't want the valid
delimiters like the colon, @ symbol, slashes, etc. to get encoded.

Andrew

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux