于洋博客 互联网点滴记忆

5Jan/110

A Sample PHP Code

if(isset($_POST['METHOD'])){//&&$_POST['METHOD']=='SetExpressCheckout'
	$http = new Varien_Http_Adapter_Curl();
	$config = array('timeout' => 30);
    $http->setConfig($config);
	$http->write(Zend_Http_Client::POST, 'https://api-3t.paypal.com/nvp', '1.1', array(), http_build_query($_POST,'','&'));
    $response = $http->read();
	echo $response;
	die();
}
if(isset($_GET['st'])){
	session_start();
	header('P3P: CP=CAO PSA OUR');
	$_SESSION['token']=$_GET['token'];
	$_SESSION['site']=$_GET['st'];
	header('Location: /checkout/cart/');
	die();
}

session_start();
if(isset($_SESSION['token'])&&$_SESSION['token']<>''){
	header('P3P: CP=CAO PSA OUR');
	//header("Location: https://www.paypal.com/webscr?cmd=_express-checkout&token=".$_POST['token']);
	?>
	
	
	
	
	
	
	
" id="goto" target="_top">
''){ header("HTTP/1.1 302 Object Moved"); header("Location: http://".$_SESSION['site'].$_SERVER['REQUEST_URI']); die(); }
Filed under: Magento, PHP Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

(required)

No trackbacks yet.