Jump to content

Craig Roberts

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Everything posted by Craig Roberts

  1. YES! Your final post, AbraCadaver, was the key. ignace's second suggestion works but only after specifying the 'http' protocol as you indicated. But, having done that, I'm now getting the expected response. file_get_contents apparently uses the POST method if you specify that in the $config array. I don't appear to have the http_post_fields function available on my server or that might have been even easier, I suppose. Anyway, thanks very much to both of you! You guys have been a great help and I appreciate you taking the time!
  2. This is almost working. I'm getting a response back from the client's PHP page and I'm able to parse it with XMLReader. But it's still giving me the default values as if I were not passing the product ID as a parameter. I'm not sure why that would be. Here's what I have: $url = $_POST['url']; $data = array('product_id' => 'K1111'); $config = array( 'method' => 'POST', 'content' => http_build_query($data), 'ignore_errors' => true ); $stream = stream_context_create($config); $response = file_get_contents($url,false,$stream); $reader = new XMLReader(); $reader->xml($response); This is very close to working. I wish I knew what was wrong. I've checked and the parameter name is correct.
  3. I haven't got this to work so far. Can you tell me what you would expect to be passed as the $content parameter? I assigned it the value "sku=K1111", which is the product ID I need to pass. Should that work?
  4. Oops, never mind ignace, I see that the answer to my question is in your sample code. I must not have scrolled down all the way. Thanks again. I'll try it and let you know.
  5. Thanks for the response ignace. So, does that mean $response will be an XML object? Can I move through that and grab text node values using XMLReader?
  6. I'm sure this is a simple question, and I'm not a total newbie, but I keep drawing a blank. In accordance with existing specifications, a client has created a PHP page on their web server which responds to a query by returning a small block of XML. I need to use that XML, and I have no problem doing that using XMLReader->open(clientURL). I can call the client's PHP page and get XML back that I can parse and everything is wonderful. Except for one thing: I need to send a product ID when I call the client's PHP page, and I need to send it using the POST method. I guess that means my clean and neat one-step process is going to have to become a two-step process, and I'm going to have to use some other means besides XMLReader->open() to retrieve the XML. Can sombody recommend the best way to do this? I need to send POST data first to get the correct XML response, and then I need to capture the XML in a way that allows me to parse it.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.