homepage Welcome to WebmasterWorld Guest from 54.226.180.86
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
cXML Post & Parse - PHP
Question about cXML Post and Parse
cocorocks




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

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?

 

httpwebwitch




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

Welcome to WebmasterWorld, cocorocks!

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

dreamcatcher




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

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved