On Mon, 20 Dec 2004 19:12:23 -0500, "Chung Leong"
<ch***********@hotmail.com> wrote:
"Gary Quiring" <gq******@msn.com> wrote in message
news:hc********************************@4ax.com.. . I am trying to test a PHP script that is going to parse an XML string
to access an Informix database. I have successfully recompiled PHP
for Informix. I am running Fedora Core 3 with PHP 5.
How can for testing purposes send an XML file to my PHP program
running on Apache?
Thanks
Gary
See http://www.php.net/stream_context_create/ . To perform a body, change
the method item to POST and put the post data in a array item keyed by
'body'.
I got it. Thank you. I have no idea what I am doing because I don't
know HTML either. But I got it working using something similiar to
what you recommended:
$xmlfile = implode('', file('xml'));
$alternate_opts = array(
'http'=>array(
'method'=>"POST",
'header'=>"Content-type: application/x-www-form-urlencoded\r\n" .
"Content-length: " . strlen("$xmlfile"),
'content'=>"$xmlfile"
)
);
$context = stream_context_create($alternate_opts);
$fp = fopen('http://www.testsite.com/index.php', 'r', false,
$context);
fpassthru($fp);
fclose($fp);
Thanks
Gary Quiring