Welcome to WebmasterWorld Guest from 54.224.17.208

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

cXML Post & Parse - PHP

Question about cXML Post and Parse

     
4:58 pm on Oct 27, 2009 (gmt 0)

5+ Year Member



I am trying to make my ecommerce site work effectively with a buyer that requires a 3rd party procurement system.

They have told me that they are posting the data using the following method:

<?php
$fp = fsockopen("www.example.com", 80, $errno, $errstr, 30);
if (!$fp)
{
echo 'Could not open connection.';
}
else
{
$xmlpacket ='<?xml version="1.0"?>
<Your_xml>
</Your_xml>';
$contentlength = strlen($xmlpacket);
$out = "post /script_name.php HTTP/1.0\r\n";
$out .= "Host: www.example.com\r\n";
$out .= "Connection: Keep-Alive\r\n";
$out .= "Content-type: application/x-www-form-urlencoded\r\n";
$out .= "Content-length: $contentlength\r\n\r\n";
$out .= "xml=$xmlpacket";
fwrite($fp, $out);
while (!feof($fp))
{
$theOutput .= fgets($fp, 128);
}
fclose($fp);
// $theOutput is the response returned from the remote script
}
?>

When they run tests, or when I run tests (both with valid XML, not just the empty XML in the example), I end up with nothing but an empty array when I echo $_POST.

Does anyone have any insight on what the problems might be here? Is there any other way that I could be receiving and access this information other than inside the $_POST variable?

10:33 pm on Oct 27, 2009 (gmt 0)

WebmasterWorld Administrator httpwebwitch is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Welcome to WebmasterWorld, cocorocks!

I'm going to move this one into the PHP forum, OK?

4:20 pm on Oct 28, 2009 (gmt 0)

WebmasterWorld Senior Member dreamcatcher is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Hi cocorocks, welcome to WebmasterWorld. :)

When you check the post array you need to use print_r. Is that how you were doing it and echo was a typo?

echo '<pre>';
print_r($_POST);
echo '</pre>';

If you are just echoing $_POST you will see 'Array' and nothing more.

dc

 

Featured Threads

Hot Threads This Week

Hot Threads This Month