Use Paypal Pro Directpayment in php
<p>I am testing paypal sandbox with curl but every thime it is giving me login page of sandbox.What is wrong in it ?  I want to use paypal pro from my website. I dont want to go
on paypal site. All the payment must me done on website.</p>

<pre><code>function PPHttpPost($methodName_, $nvpStr_){ 
                global $environment;
                // Set up your API credentials, PayPal end point, and API version.
                $API_UserName = urlencode('XXXXXXXXXXXXXX');
                $API_Password = urlencode('XXXXXXXX');
                $API_Signature = urlencode('XXXXXXXXXXXXX');

                $version = urlencode('51.0');

                // Set the curl parameters.
                $ch = curl_init("https://www.sandbox.paypal.com/cgi-bin/webscr");
                //curl_setopt($ch, CURLOPT_URL, "");
                //curl_setopt($ch, CURLOPT_VERBOSE, 1);

                // Turn off the server and peer verification (TrustManager Concept).
                curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
                //curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
                curl_setopt($ch, CURLOPT_HEADER, false);
                curl_setopt($ch, CURLOPT_USERAGENT, 'cURL/PHP');
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                curl_setopt($ch, CURLOPT_POST, 1);

                // Set the API operation, version, and API signature in the request.
                $nvpreq = "METHOD=$methodName_&amp;VERSION=$version&amp;PWD=$API_Password&amp;USER=$API_UserName&amp;SIGNATURE=$API_Signature$nvpStr_";

                // Set the request as a POST FIELD for curl.
                curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);

                // Get response from the server.
                $httpResponse = curl_exec($ch);
                   print_r($httpResponse); die;
                if(!$httpResponse) {
                    exit("$methodName_ failed: ".curl_error($ch).'('.curl_errno($ch).')');
                }

                // Extract the response details.
                $httpResponseAr = explode("&amp;", $httpResponse);

                $httpParsedResponseAr = array();
                foreach ($httpResponseAr as $i =&gt; $value) {
                    $tmpAr = explode("=", $value);
                    if(sizeof($tmpAr) &gt; 1) {
                        $httpParsedResponseAr[$tmpAr[0]] = $tmpAr[1];
                    }
                }

                if((0 == sizeof($httpParsedResponseAr)) || !array_key_exists('ACK', $httpParsedResponseAr)) {
                    //exit("Invalid HTTP Response for POST request($nvpreq) to $API_Endpoint.");
                }

                return $httpParsedResponseAr;
            }
</code></pre>
