Make A POST Including a HTTP Basic Authorization header via PHP cURL -


instruction

making post request content-type x-www-form-urlencoded following url:https://api/openid/token/revoketoken including http basic authorization header, consisting of base64 encoding of username:password

the call should issue 200 ok responses when token not recognized. errors communicated client using response body.

tries

i tried

$openid_token_revoke_url = 'https://api/openid/token/revoketoken'; $auth_code = base64_encode('username:password'); //dxnlcm5hbwu6cgfzc3dvcmq=  $ch = curl_init(); curl_setopt($ch, curlopt_url,$openid_token_revoke_url); curl_setopt($ch, curlopt_userpwd, $auth_code); curl_setopt($ch, curlopt_post, 1); curl_setopt($ch, curlopt_httpheader, array('content-type: application/x-www-form-urlencoded'));   // receive server response ... curl_setopt($ch, curlopt_returntransfer, true);  $server_output = curl_exec ($ch);  curl_close ($ch);  dd($server_output); 

i got

"<html><head><title></title></head><body>15058752898584540867</body></html>" 

i try

$headers = array(       "content-type: application/x-www-form-urlencoded",       "authorization: basic " . $auth_code   );  $ch = curl_init(); curl_setopt($ch, curlopt_url,$openid_token_revoke_url); curl_setopt($ch, curlopt_post, 1); curl_setopt($ch, curlopt_httpheader,$headers); curl_setopt($ch, curlopt_returntransfer, true); $server_output = curl_exec ($ch);  dd($server_output); 

i got same result above

"<html><head><title></title></head><body>15058752898584540867</body></html>" 

according instruction idp

"errors communicated client using response body"

is mean error base on got curl ?


Comments

Popular posts from this blog

How to understand 2 main() functions after using uftrace to profile the C++ program? -

c# - Update a combobox from a presenter (MVP) -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -