Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Get data with Web Service


magol

Recommended Posts

I have take over a project where they are using osCommerce (I have never use it before). The first problem I have to solve is that they have to input all articles manually from the XML-file they get from the deliver. I want that osCommerce automatly get the Web Service data and publish it on the site. How can I solve it on the best and easiest way (its many 1000 of articles)

Link to comment
Share on other sites

SOAP?

 

If it is an exposed web service the easiest method is to use SOAP to pull the data and then format it locally.

 

However, if it is simply an XML feed then parse the data with native PHP XML functions.

 

...should be a 30 minute job.

 

Bobby

Link to comment
Share on other sites

...should be a 30 minute job.

 

If I now how to develop agents osCommerse, it maybe took 30 minutes. But, I don?t now where to start. Can you please give me any suggestion what I can start with?

 

And, it is a XML-file I get when I send a POST request to de deliver (maybe not real Web Service). I want that the shop always have actual data.

Link to comment
Share on other sites

Let me see if I have this correct:

 

You want to send a POST request to a specific URL then receive an XML formatted data response. Upon receiving the response you will parse and formt the data locally. Is this correct?

 

To make a POST request use the http_client. Here is some example code to get your started:

	include_once('includes/classes/http_client.php');

$url = 'yoururl - fill this in accordingly';
$tmp = @parse_url($url);
$useragent = 'Client Reqeust'; 
$server = $tmp['host'];
$scheme = ( isset($tmp['scheme']) ? $tmp['scheme'] : 'http');
$path = ( isset($tmp['path']) ? $tmp['path'] : '/' );

$spider = new httpClient();
$spider->Connect($server, 80);
$spider->addHeader('Host', $server);
$spider->addHeader('User-Agent', $user_agent);
$spider->addHeader('Connection', 'Close');

$url = "$scheme://$server$path";

if ($spider->Get($url) == '200') {
 $status = $spider->getStatus();
 $headers = $spider->getHeaders();
 $body = $spider->getBody();
 // do some stuff with the $body variable
}
else {
 die('<div style="border:solid; padding:5px; border-color:#999999; border-width:thin; background-color:#FFFFCC;"><h2>Problem : ' . $spider->getStatusMessage() . '</h2></div>');
}

$spider->Disconnect();

That should get your started...

 

Bobby

Link to comment
Share on other sites

That is beyond the scope of a single thread. It's not hard to do but not so easy either...I would say it's about intermediate level.

 

Good luck with your project!

 

Bobby

Link to comment
Share on other sites

  • 5 years later...

@Chemo

I have a question? Do you have an existing web service in Os Commerce to fetch the data form the site and convert it to some other form like XML etc so that it becomes compatible with other applications developed in , may be JAVA..

Link to comment
Share on other sites

Vikram,

 

Chemo has not been active on this website since 2005.

 

Perhaps you should start a new thread stating your question so others can offer their input.

 

 

Chris

Link to comment
Share on other sites

Vikram,

 

Chemo has not been active on this website since 2005.

 

Perhaps you should start a new thread stating your question so others can offer their input.

 

 

Hi,

Thanks for that chris !! But i have alreday started a thread yest and was searching others with similar contents. That was the reason i posted here. Can you plz say me whether there is some existing web service or not? You had yest asked me to elaborate my question in the other thread rit? Hope now you can answer ?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...