Retrieve a 2checkout order details using php / curl?
Hello,I am trying to write a script to check if payments are active or have been stopped. I am using php and curl.
PHP Code:
$cologin = "username";
$copassword = "password";
$ch = curl_init();
curl_setopt($ch, CURLOPT_VERBOSE, 1); ########### debug
curl_setopt($ch, CURLOPT_URL, 'https://www.2checkout.com/2co/login');
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_COOKIEJAR, "my_cookies1.txt"); //initiates cookie file if needed
curl_setopt($ch, CURLOPT_COOKIEFILE, "my_cookies1.txt"); // Uses cookies from previous session if exist
$result=curl_exec ($ch);
curl_close ($ch);
// GET COOKIE
eregi("TCOID\=([0-9a-z]+)", $result, $regs);
$tcoid = $regs[1];
print $result;
exit;
$ch = curl_init();
curl_setopt($ch, CURLOPT_VERBOSE, 1); ########### debug
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, 'username='.$cologin.'&password='.$copassword.'&TCOID='.$tcoid);
curl_setopt($ch, CURLOPT_URL, 'https://www.2checkout.com/2co/login?TCOID='.$tcoid);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)');
curl_setopt($ch, CURLOPT_REFERER, 'https://www.2checkout.com/2co/login?TCOID='.$tcoid);
curl_setopt($ch, CURLOPT_COOKIEJAR, "my_cookies.txt"); //initiates cookie file if needed
curl_setopt($ch, CURLOPT_COOKIEFILE, "my_cookies.txt"); // Uses cookies from previous session if exist
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_HEADER, 1);
$result=curl_exec ($ch);
curl_close ($ch);
print $result;