cURL和paypal的新手......我做错了什么?

I am having no luck in contacting paypal.com with my cURL code...does it look OK? I'm relatively new to php and to cURL. Lately, I've been getting error 6 but occasionally it goes through but nothing activates back on my end. I get nothing back from the target. Do I have the cURL options set appropriately?

$cmdstring =  "cmd=_cart&upload=1&business=registration@example.com";
$cmdstring .= "&custom=12-1,13-1";
$cmdstring .= urlencode("&notify_url=http://www.example.com/paypalipn.php");
$cmdstring .= "&return=http://www.example.com/checkout_complete.php";
$cmdstring .= "&rm=2";
$cmdstring .= "&cbt=Return%20to%20Example%202015%20website";
$cmdstring .= "&cancel_return=http://www.example.com/paypal_cancel.php";
$cmdstring .= "&lc=US";
$cmdstring .= urlencode("&currency_code=USD");

$curl_connection = curl_init("https://www.sandbox.example.com/cgi-bin/webscr");

curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($curl_connection, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1");
curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl_connection, CURLOPT_POST, true);

curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $cmdstring);

$result = curl_exec($curl_connection);

Thanks in advance

The string you're building is a Website Payments Standard string. These are designed to be forwarded in the browser of a respective buyer.

The following 302 redirect to a session URL cannot be used to forward a buyer to PayPal. You need to display a link or a button that POSTs this information through the users browser.

Further, you're missing item details in that call. Here's a working cart upload HTML form:

<form method="post" action="https://www.sandbox.paypal.com/cgi-bin/webscr" name="form1">
<input type="hidden" value="_cart" name="cmd">
<input type="hidden" value="1" name="upload">
<input type="hidden" value="KKZAQCGG9C5CJ" name="business">
<input type="hidden" value="EUR" name="currency_code">

<input type="hidden" value="http://localhost/return" name="return">
<input type="hidden" value="http://localhost/cancel" name="cancel_return">

<input type="hidden" value="Test Item 1" name="item_name_1">
<input type="hidden" value="2" name="quantity_1">
<input type="hidden" value="400" name="amount_1">
<input type="hidden" value="9.99" name="shipping_1">

<input type="hidden" value="Test Item 2" name="item_name_2">
<input type="hidden" value="1" name="quantity_2">
<input type="hidden" value="100" name="amount_2">

<input type="hidden" value="https://static.e-junkie.com/sslpic/90711.d81b6c23d4327edc88c0dcf78360d9e2.jpg" name="cpp_header_image">
<input type="submit" value="Buy Now" name="submit">
</form>