This is just to repeat the PHP code of PayPal's restful API curl way:
The following paragraph is the PayPal official given command line under the Get Access_token Curl method:
Curl Https://api.sandbox.paypal.com/v1/oauth2/token-H "Accept:application/json" \ H "Accept-language:en_us" \ U "E Oj2s-z6oon_le_ks1d75wsz6y0sfdvsy9183ivxfyzp:eclusmeuk8e9ihi7zdvlf5cz6y0sfdvsy9183ivxfyzp "\ d" grant_type=client _credentials "
Ps:-h is actually the header,
-U is the user name and password
-D is the data data that requires post
$ch = curl_init (); $clientId = $this->client_id; $ secret = $this->secret; curl_setopt ($ch, curlopt_url, "https://api.sandbox.paypal.com/v1/oauth2/ Token "); curl_setopt ($ch, curlopt_header, false); curl_setopt ($ch, curlopt_ssl_verifypeer, false); curl_setopt ($ch, curlopt_post, true); curl_setopt ($ch, curlopt_returntransfer, true); curl_setopt ($ch, curlopt_userpwd, $clientId. ":". $secret); &nBsp; curl_setopt ($ch, curlopt_postfields, "Grant_type=client_credentials"); $result = curl_exec ($ CH); if (Empty ($ Result) Die ("Error: no response."); else { $json = json_decode ($result); print_r ($json); } curl_close ($ch);d ie;
Okay, it's ready!
PS: About the code inside the client_id and secret is needed to create a PayPal developer site to create an app will have, not many statements, attached to the PayPal Developer's website: https://developer.paypal.com/docs/api/
This article from "for the Future" blog, declined reprint!
PayPal Paid refund Refund Getaccesstoken