Skip to content

Instantly share code, notes, and snippets.

@craigchristenson
Created October 5, 2012 16:35
Show Gist options
  • Select an option

  • Save craigchristenson/3840873 to your computer and use it in GitHub Desktop.

Select an option

Save craigchristenson/3840873 to your computer and use it in GitHub Desktop.
2Checkout API PHP
<?php
$ch = curl_init("https://www.2checkout.com/api/sales/detail_sale?sale_id=1234567890");
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept: application/json"));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, "2Checkout PHP/0.1.0");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "apiusername:apipassowrd");
$json_resp = curl_exec($ch);
curl_close($ch);
//decode to an associative array
$array_resp = json_decode($json_resp, true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment