curl - GET method PHP for accessing and displaying Information from web services -
i wish know how pass variable in http header field? tried code , returns me status 500 error.
echo $token; curl_setopt($ch, curlopt_httpheader, array( 'content-type: application/json', 'x-auth-token: $token')); this error receiving:
{"timestamp":1436349947368,"status":500,"error":"internal server error","exception":"java.lang.runtimeexception","message":"org.springframework.security.core.userdetails.usernamenotfoundexception: user name not found","path":"/api/customers/new"}
i have stored token received web service in $token, can please tell me going wrong?
looking forward response,
thank you
the problem seems use single quotation mark, want pass token var.
should be:
echo $token; curl_setopt($ch, curlopt_httpheader, array( 'content-type: application/json', "x-auth-token: $token"));
Comments
Post a Comment