Welcome Guest, Not a member yet? Register   Sign In
XML-RPC - Building a catalog from an external XMLDataStream
#6

[eluser]ModernM[/eluser]
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?

Code:
<?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 = '<?xml version=\“1.0\” encoding=\“UTF-8\”?>\n\n';
  $post .= '<XMLDataStreamRequest>\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';
  
  //theme
  $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);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
  $res = curl_exec($ch);
  curl_close ($ch);
  
  //echo $res;
  
  if( ! $xml = simplexml_load_string($res) )
   {
    echo 'Unable to load XML string';
    
    }
    else
    {
     foreach( $xml as $Item )
     {
      echo 'PrName: '.$Item->PrName.'<br />';
      }
      
      }
  

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



}

Whats returned is
PrName:
PrName:
PrName:

Any ideas?

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


Messages In This Thread
XML-RPC - Building a catalog from an external XMLDataStream - by El Forum - 06-26-2012, 05:41 PM



Theme © iAndrew 2016 - Forum software by © MyBB