Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //ButtonManager API
- $ret = ch_post();
- error_log($ret);
- echo urldecode($ret);
- function ch_post(){
- //API Credentials
- $accID = urlencode("accID");
- $username = urlencode("username_api1.website");
- $password = urlencode("password");
- $signature = urlencode("signature");
- $appID = urlencode("APP-ID");
- $endpoint = "https://api-3t.sandbox.paypal.com/nvp";
- $certpath = "C:certpath.pem";
- $ch_headers = array(
- "USER"=>$username,
- "PWD"=>$password,
- "SIGNATURE"=>$signature,
- "APPID"=>$appID,
- "VERSION"=>"51.0"
- );
- $ch_params = array(
- "METHOD"=>urlencode("BMCreateButton"),
- "OTHERPARAMS"=>urlencode("OTHER")
- );
- $ch = curl_init($endpoint);
- curl_setopt($ch,CURLOPT_HTTPHEADER,http_build_query($ch_headers));
- curl_setopt($ch,CURLOPT_CAINFO,$certpath);
- curl_setopt($ch,CURLOPT_POSTFIELDS,http_build_query($ch_params));
- curl_setopt($ch,CURLOPT_POST,TRUE);
- curl_setopt($ch,CURLOPT_HEADER,TRUE);
- curl_setopt($ch,CURLOPT_RETURNTRANSFER,TRUE);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
- curl_setopt($ch,CURLOPT_SSLVERSION, 6);
- $cexec = curl_exec($ch);
- if(!$cexec) {
- $response = "Failed: ".curl_error($ch)."(".curl_errno($ch).")";
- curl_close($ch);
- return $response;
- }
- curl_close($ch);
- return $cexec;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement