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

Issue on PHP5, Curl & Basic Auth



Hi,

hopefull this is the right place to drop this issue. If not I am sorry.

I am running debian-5.0beta1 on a NSLU2 and quite happy with it. However yesterday, I tried to work on a php script using curl to access a website that is protected by basic authentifcation. I am always getting a curl error "Failed to open/read local data from file/application". But I was not able to identify the problem, especially because the code seems to be fairly easy. So I did try it on my fedora 8 system and it works perfectily fine. Also a debian 4 system in a vm, was able to access the website without any problems. I don't know any real differences between the debian 4 system and the debian arm on my NSLU2, so I think there might be a problem underlying.

The following code was tested on an apache2, php5 (php5-curl):
<?php
	$userpwd = "test:1234";

	$ch = curl_init ();

	curl_setopt ($ch, CURLOPT_USERPWD, $userpwd);
	curl_setopt ($ch, CURLOPT_URL, "http://www.phobeus.de/test/test";);
	curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_setopt ($ch, CURLOPT_POST, 1); $status = curl_exec ($ch); echo curl_error($ch); curl_close ($ch);

echo $status; ?> It is addressing a test account on my webspace. I tried to further investigate the problem, running curl from console with "curl -u test:1234 http://www.phobeus.de/test/test"; and it wored fine. I also tried to using php+curl with an webpage without basic auth and it worked also. The server error log doesn't seems to contain anything concerning this issue.
Maybe anyone can confirm this problem (or show me where I fail).
I am also open for any suggestion on further investigate my problem.

Sincerly,
Florian


Reply to: