-1

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);
?>
Doulat Khan
  • 493
  • 5
  • 24
  • 403 means access denied. Your URL seems to not be correct. First of all it is uncommon for pages to sign in via GET requests and secondly the GET request parameters are separated via a `?` e.g. `aspx?Login=mylogin` – apokryfos Oct 27 '16 at 15:38
  • ohh my brother login=mylogin and password=mypass is not like that. will i share my API credentials publically?? You can share but atleast i can't bro. – Doulat Khan Oct 28 '16 at 09:47
  • That's not what I said – apokryfos Oct 28 '16 at 09:48
  • Brother it is not the way that if someone do mistake you vote minus. Stack overflow is community that needy people come here to seek something. i have problem so i ask if you have no solution then don't reply on it. – Doulat Khan Oct 28 '16 at 09:57
  • Does the remote server accept authentication via GET requests? – apokryfos Oct 28 '16 at 10:11
  • Dear i m sorry #apokryfos actually it that time i was not get your point but when i put "?" before Login=mylogin this it return true and the code is 200. So its my humble request that please take your minus vote please. i will further expecting that from you for my help think you. – Doulat Khan Oct 31 '16 at 10:20

2 Answers2

0

Look at your xml file. You have the closing nodes reversed:

<xmldata>
  <Products>
    <productcode>1000112323</productcode> 
    .....
  </xmldata>
</Products>

As to the 403 error, you might need addition entries in the header you are passing with cURL.

Phil S
  • 179
  • 2
0

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.

Community
  • 1
  • 1
Doulat Khan
  • 493
  • 5
  • 24