Last active
August 29, 2015 14:07
-
-
Save albinekb/397a1e0a59a570c5d05f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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