Page 1 of 1

PHP fopen of password protected URLs

Posted: Sat Mar 12, 2005 1:13 am
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.

Posted: Sat Mar 12, 2005 1:19 am
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.

Posted: Sat Mar 12, 2005 2:30 am
by feyd
something tells me.. rawurlencode()

Posted: Sat Mar 12, 2005 7:11 am
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

Posted: Sun Mar 13, 2005 3:15 pm
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

Posted: Sun Mar 13, 2005 3:20 pm
by feyd
what, exactly, did you try? post the code.

Posted: Wed Jun 15, 2005 5:20 am
by William
He hides the username & password then puts it in the error.