0

I have set username and password in curl request but not get in request

curl_setopt($ch, CURLOPT_USERPWD, "username" . ":" . "pwd");

$_SERVER['PHP_AUTH_USER']
$_SERVER['PHP_AUTH_PW']

not get username and password using above $_server[''] please anyone help me

i get error like Undefined index: PHP_AUTH_USER

Mokariya Sanjay
  • 194
  • 3
  • 13
  • If you are using PHP 7, use [Coalesce operator](https://www.tutorialspoint.com/php7/php7_coalescing_operator.htm) `??`, to check and set default values for undefined variables/indexes etc – Madhur Bhaiya Sep 11 '18 at 06:13
  • @☝️ I don't think *suppressing the error* is what's intended here… – deceze Sep 11 '18 at 06:24
  • i just send curl request of username and password but when i get it in other server it's give a error Undefined index: PHP_AUTH_USER – Mokariya Sanjay Sep 11 '18 at 06:24
  • check this https://stackoverflow.com/questions/3663520/php-auth-user-not-set – vishal shah Sep 11 '18 at 06:24
  • it's working on local but not in server – Mokariya Sanjay Sep 11 '18 at 06:27
  • That very specifically depends on your server and whether/how your server passes the information through to PHP. See the duplicate for possible solutions. If that doesn't work, we'll need to know more about your server. Perhaps you need to talk to the people that administer your server. – deceze Sep 11 '18 at 06:30
  • My Server API" is CGI/FCGI, so there is a any way to use HTTP auth from PHP – Mokariya Sanjay Sep 12 '18 at 07:13

0 Answers0