• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
XML-RPC - Building a catalog from an external XMLDataStream

Hello Codeigniter,

I had a general question on a project I am about to begin. Its a personal project that, but hopefully I will gain a wealth of knowledge as I execute this.

I need to know some basics about how I should proceed sprinkled with some tech talk to make sure I am heading in the right direction here.

I am going to use code igniters XML-RPC to send requests to a server that has a catalog XML data stream. I was provided documentation and I have read through it, and I do understand for the most part everything that is in there. I was also provided some XML file as examples.


and a XMLCatReqResponse

&lt;?xml version="1.0"?&gt;
<Name>Address Books</Name>

I am familiar with working with MVC, but never with XML. Could someone give me a kick start here and also valid or invalidate that I am looking at this correctly and if not please provide me some direction.

Maybe if someone can put a simple example together for me so I can see how codeigniter and the XML above translate into one another that would be huge.

I am not asking you to build me the entire project just a little nudge in the right direction.

Much Appreciated.

Well after a day of fiddling with the XML RPC I have read that the format of the post and get structure of the XML is very tight and not flexible. I am able to knock on the door so to speak with the xML rPC but i need to send specific information to the service(datastream) in order to get back a responses.

Here is where I am at.

Hopefully someone can help me out here, i think I need to come at this another direction but I have no idea where to start. According to the dev manual for the data feed I need to POST the data shown in the XML format they provide. I havent worked with XML and PHP enough to send it anywhere so I am a bit stuck.

Hopefully someone can shed some light on this for me. Give a man a fish feed him for a day, teach a man to fish feed him for life. I am learning to fish I know, just need to know what bait to use and what pole, and I think I can sort out the rest slowly.


moving along, went to cURL to get the data, now I am trying to build the catalog from the return of the raw XML. Tried using CSS but I have images I need to setup.

Anyone out there willing to guide me in the right direction.

PHP5 has a wonderful tool simplexml

Here's a decent tutorial: http://www.phpro.org/tutorials/Introduct...h-PHP.html

Thank you! I'll try this doc after lunch. I think I'm sooooo close yet so far away. Smile

So I read through the material, and yes i think this will work. When I do the demo on the site I can pull through the XML data, but when I try to load my data in I only get 3 returns.

Now I suspect it might be that I am using cURL to post the requests and then its coming back in the variable $res. Could it be that I have too much in one controller trying to get the data and then parse it?

&lt;?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Catalog extends CI_Controller {

function index(){

  //$catid = $_GET['catid'];
  $catid = 'aprons';
  //echo 'This is the cat ID called by the URL => '.$catid;
  $post = '&lt;?xml version=\“1.0\” encoding=\“UTF-8\”?&gt;\n\n';
  $post .= '&lt;XMLDataStreamRequest&gt;\n';
  $post .= '<Auth>\n';
  $post .= '<AcctID>123</AcctID>\n';
  $post .= '<LoginID>login</LoginID>\n';
  $post .= '<Password>pass</Password>\n';
  $post .= '<Search>\n';
  $post .= '<Category>'.$catid.'</Category>\n';
  $post .= '</Search>\n';
  $post .= '&lt;/XMLDataStreamRequest&gt;\n';
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL,'https://www.promoplace.com/ws/ws.dll/XMLDataStream');
  curl_setopt($ch, CURLOPT_POST, TRUE);
  curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
  $res = curl_exec($ch);
  curl_close ($ch);
  //echo $res;
  if( ! $xml = simplexml_load_string($res) )
    echo 'Unable to load XML string';
     foreach( $xml as $Item )
      echo 'PrName: '.$Item->PrName.'<br />';

   //$data['list_view'] = $res;
   //$this->load->view('list_view', $data);


Whats returned is

Any ideas?

Again, thank you very much for your help, teaching a man to fish.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.