Search code examples
phpapicurlvolusion

How to fix 403 error when sending cURL request to Volusion API


I develop a script in PHP for insertion/import but when I run my PHP cURL script, it return 403 code. I search 403 code for error so i find the I don't know that what is the actual problem.

<?php
$url = 'http://tebkq.mvlce.servertrust.com/net/WebService.aspxLogin=mylogin&EncryptedPassword=mypass&Import=Insert-Updat';

$xml = file_get_contents('http://tlztechnologies.com/volusion/dataPro.txt', true);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml); 
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type:application/x-www-form-urlencoded; charset=utf-8", "Content-Action:Volusion_API"));

$head = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

echo $httpCode ;


curl_close($ch);
?>


Solution

  • So finally I got the answer. The main reason was that I was trying on trial version. Then i chat with Volusion support I share my code with them, they says that you can't customize and import products with API until you buy a plan not less then PRO. I have post an answer of problem likely about product insertion with API.

    Product Import/Insertion using Volusion API

    Volusion price plan and their rights

    When I buy Pro plan so it start work.