PHP fopen of password protected URLs

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
brad7451
Forum Newbie
Posts: 4
Joined: Sat Mar 12, 2005 1:03 am

PHP fopen of password protected URLs

Post by brad7451 »

Please Help,

I am trying to open a password protected URL with PHP, using the normal method of fopen as in $fp = fopen('http://[username]:[password]@domain.com', 'r') does not work. I think the problem is that the username portion is an email address which obviously contains the '@' symbol.

Here is the error that I get.

Warning: fopen(http://adsl114354@dsl512.llink.co.za:aa ... .saix.net/) [function.fopen]: failed to create stream: Inappropriate ioctl for device in /var/www/html/somesite/adsl.php on line 10.

Usernames, Passwords and Domains are ficticious.

Please Help.
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

as far as i'm aware, i don't think the E operator int he fopen statement is valid.

a good site for you to view right now would be http://us3.php.net/fopen.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

something tells me.. rawurlencode()
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Or you can always use "Curl" Sometimes fopen just can't do everything. http://us4.php.net/manual/en/ref.curl.php
brad7451
Forum Newbie
Posts: 4
Joined: Sat Mar 12, 2005 1:03 am

Post by brad7451 »

Ambush Commander wrote:Or you can always use "Curl" Sometimes fopen just can't do everything. http://us4.php.net/manual/en/ref.curl.php
Tried it but it did not work. I will try CURL and see. Thanks anyways
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

what, exactly, did you try? post the code.
User avatar
William
Forum Contributor
Posts: 332
Joined: Sat Oct 25, 2003 4:03 am
Location: New York City

Post by William »

He hides the username & password then puts it in the error.
Post Reply