473,499 Members | 1,710 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need to post XML file to URL

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

Jul 17 '05 #1
8 3714
Gary Quiring wrote:
How can for testing purposes send an XML file to my PHP program
running on Apache?


As a wild guess: how about trying to send it just like any other type
of file?

--
Markku Uttula

Jul 17 '05 #2
"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'.

Jul 17 '05 #3
On Tue, 21 Dec 2004 01:23:26 +0200, "Markku Uttula"
<ma***********@disconova.com> wrote:
Gary Quiring wrote:
How can for testing purposes send an XML file to my PHP program
running on Apache?


As a wild guess: how about trying to send it just like any other type
of file?

That would be dandy if I knew how to do that!!!!
Jul 17 '05 #4
Hello,

on 12/20/2004 08:46 PM Gary Quiring said the following:
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?


That depends on how you want to send the file: like a file form field or
in the body of the POST request?

Either way you can use this HTTP client class that comes with examples
of how to send files in either way.

http://www.phpclasses.org/httpclient
--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
Jul 17 '05 #5
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

Jul 17 '05 #6
In article <hc********************************@4ax.com>, Gary Quiring wrote:
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?


A very basic function that allows you to post stuff:
http://home.mysth.be/~timvw/programming/php/client.txt
Receiving xml:
<?php
$data = file_get_contents('php://input');
// do whatever you want to do with the data
?>
--
Met vriendelijke groeten,
Tim Van Wassenhove <http://www.timvw.info>
Jul 17 '05 #7
Gary Quiring wrote:
How can for testing purposes send an XML file to my PHP program
running on Apache?


As a wild guess: how about trying to send it just like any other
type
of file?


That would be dandy if I knew how to do that!!!!


Sorry. For some reason I was under the impression that you thought
something special was needed to be able to upload XML-files (in
contrast to any other file type). Information on file upload in
general can be found at
http://www.php.net/manual/en/features.file-upload.php (if that is of
any help to you).

--
Markku Uttula

Jul 17 '05 #8
On Tue, 21 Dec 2004 18:14:30 +0200, "Markku Uttula"
<ma***********@disconova.com> wrote:
Gary Quiring wrote:
How can for testing purposes send an XML file to my PHP program
running on Apache?

As a wild guess: how about trying to send it just like any other
type
of file?


That would be dandy if I knew how to do that!!!!


Sorry. For some reason I was under the impression that you thought
something special was needed to be able to upload XML-files (in
contrast to any other file type). Information on file upload in
general can be found at
http://www.php.net/manual/en/features.file-upload.php (if that is of
any help to you).

No problem, just a newbie with lots of OLD programming experiece. I am not used
to PHP or HTML. I have a vendor that is only sending data using XML via HTTP.
We usually do all work in FTP with UNIX and Informix 4GL. I am limping along
but it's really hard to test this stuff.

Gary
Jul 17 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3102
by: Spamtrap | last post by:
I only do occasional Perl programming and most things I write are short processes. I have something I'm working on that is scanning a text file with about 15 million lines and trying to extract...
17
2063
by: freemann | last post by:
Can anyone provide example code showing how to send form results to a results page, email and a comma delimited file? Notice that I need it going to all three locations. Details: I have forms...
66
5276
by: genestarwing | last post by:
QUESTION: Write a program that opens and read a text file and records how many times each word occurs in the file. Use a binary search tree modified to store both a word and the number of times it...
1
4829
by: capb | last post by:
Hello, This is my first post, and any help would be greatly appreciated. I create online memorials which contain guestbooks which have been the subject of computer generated spam. I have been able...
7
2815
by: nass | last post by:
hi all, i am running slackware linux and need to use some function that will will enable me to write and read from a shared mem segment.. i am using open() , to open a file, and then use mmap to...
2
2568
kamill
by: kamill | last post by:
i need to write content of one text file into another text file. My code is working ,if i choose both files from same directory where my program reside..BUT,its not working if i select files from...
25
3081
by: Jon Slaughter | last post by:
I have some code that loads up some php/html files and does a few things to them and ultimately returns an html file with some php code in it. I then pass that file onto the user by using echo. Of...
6
4846
by: howa | last post by:
Suppose the file is stored in "upload_tmp_dir ", so why I need to increase the memory limit? If I want to upload 100 MB, how large should I set? Thanks.
4
1885
by: mpatharkar | last post by:
Hi all, I wrote a script to search a pattern in input file and if pattern does not found in input file ,print that pattern in to output file. The input file is...
4
1896
by: Tom | last post by:
I am trying to update another developers code, and am stuck in a cludge. It works like this: A user uploads a file from the web page. Our code reads from a NetworkStream to a Filestream, and...
0
7009
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7223
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6899
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7390
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4602
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3103
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3094
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1427
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.