Skip to content

Instantly share code, notes, and snippets.

@gjsoulman
Created June 18, 2011 18:12
Show Gist options
  • Save gjsoulman/1033353 to your computer and use it in GitHub Desktop.
Save gjsoulman/1033353 to your computer and use it in GitHub Desktop.
PHP CURL PUT to Spreedly Core
<?php
$apiLogin = 'Ll6fAtoVSTyVMlJEmtpoJV8Shw5';
$apiSecret = 'RKOCG5D8D3fZxDSg504D0IxU2XD4Io5VXmyzdCtTivHFTTSylzM2ZzTWFwVH4ucG';
$paymentToken = 'N2V9GWfTgYv4jXAz2vcc4T3i8f6';
$url = 'https://spreedlycore.com/v1/payment_methods/' . $paymentToken . '/retain.xml';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_USERPWD, $apiLogin . ':' . $apiSecret);
curl_setopt($ch, CURLOPT_PUT, true);
// Attempt to set content-length to 0 to workaround nginx error...
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/xml', 'Content-length: 0'));
curl_exec($ch);
curl_close($ch);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment