Hi all,
I want to create an URL to use with fopen($url).
The URL needs basic authentication, but I have no CURL on this
particular machine.
(I need to access an app that uses REST.)
I tried to use the URLwrappers for fopen, but to no avail.
Samplecode:
$protocol = "http://";
$url = "www.example.co m/administration/webstatistics";
$username = "bla";
$password = "mypass";
$authURL = $protocol.$user name.":".$passw ord."@".$url;
$content = file_get_conten ts($authURL,'r' );
etc.
Warning: file_get_conten ts(): HTTP request failed! HTTP/1.1 401
Authorization Required in <removed>/rest.php on line 16
I know this was a shot in the dark, but that kind of URL works from my
browser, so I thought I give it a shot. Bad luck. :-(
Does anybody know if this is possible using simply fopen?
I have been reading through the streampages on php.net, but that is kind
of overwhelming to grasps right away. Working on it now.
Any advise?
Regards,
Erwin Moller
I want to create an URL to use with fopen($url).
The URL needs basic authentication, but I have no CURL on this
particular machine.
(I need to access an app that uses REST.)
I tried to use the URLwrappers for fopen, but to no avail.
Samplecode:
$protocol = "http://";
$url = "www.example.co m/administration/webstatistics";
$username = "bla";
$password = "mypass";
$authURL = $protocol.$user name.":".$passw ord."@".$url;
$content = file_get_conten ts($authURL,'r' );
etc.
Warning: file_get_conten ts(): HTTP request failed! HTTP/1.1 401
Authorization Required in <removed>/rest.php on line 16
I know this was a shot in the dark, but that kind of URL works from my
browser, so I thought I give it a shot. Bad luck. :-(
Does anybody know if this is possible using simply fopen?
I have been reading through the streampages on php.net, but that is kind
of overwhelming to grasps right away. Working on it now.
Any advise?
Regards,
Erwin Moller
Comment