Link to home
Start Free TrialLog in
Avatar of BR
BRFlag for Türkiye

asked on

how to create a header variable in PHP ?

Dear Experts,
I use PHP 7.2
I create variable as $headers to put inside the autorization information.
I connect a server which use Auth2 when ever I need it. When I got the Authorization code I insert it into database so that I can use it without calling it every time I need it. The authoraization code lives 30 minutes.
 
I select it from my database assign the password $myvariable so that I can use it efficiently.

However, it doesn't work inside the header variable. When I write the authorization code instead of $myvariable it works.
could you help me out? thank you

//it doesn't work like this. When I remove $myvariable and put the same information instead, it works.
$headers = ['Content-Type: application/json','Authorization: Autotype' . $myvariable.  " ' "];
ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of BR

ASKER

Dear Julian Hansen,
You are great, I learned a lot from you, you solve all the problems and you are  also a great teacher.
thank you so much
You are always welcome.