开发者

how to set PHP_AUTH_PW in php curl

How to set the PHP_AUTH_PW and PHP_AUTH_USER parameters in php curl.

At the server end its checking for:

if(!isset($_SERVER['PHP_AUTH_PW'])) { print "Authori开发者_StackOverflow社区zation error" }

Any help would be appreciated

Thanks


It is called basic-auth, and works with most browsers including curl on command line:

curl --user name:password http://www.example.com

and in PHP you set two options on your curl connection ($curl_conn):

curl_setopt($curl_conn, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl_conn, CURLOPT_USERPWD, 'username:password');
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜