Skip to content

Instantly share code, notes, and snippets.

@albinekb
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save albinekb/397a1e0a59a570c5d05f to your computer and use it in GitHub Desktop.
Save albinekb/397a1e0a59a570c5d05f to your computer and use it in GitHub Desktop.
<?php
$url = 'http://merchant.admin.cdon.com/api/importfile';
$key = 'nanana BATMAN';
$file_name_with_full_path = realpath('./Clothing.xlsx');
$post = array('name' => 'file', 'filename' => 'Clothing.xlsx', 'file_contents'=>'@'.$file_name_with_full_path);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$target_url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/xml',
'Authorization: api '+$key
));
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$result = curl_exec ($ch);
curl_close ($ch);
echo $result;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment