cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

RE: curl,php4 windows 2000, xml

From: David Felton <davidfelton_at_codemasters.com>
Date: Tue, 18 Nov 2003 09:01:34 -0000

You might want to try it something like this instead, rather than executing
a command-line string with exec:

        $ch = curl_init();

        curl_setopt ($ch, CURLOPT_URL,"<server to post to>");
        curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt ($ch, CURLOPT_POST, 1);
        curl_setopt ($ch, CURLOPT_POSTFIELDS, "<post field name>=<xml
data>");

        $result=curl_exec ($ch);

        curl_close ($ch);

You'll need to have the curl extension for php enabled.

-----Original Message-----
From: Bennett [mailto:bennett_at_glengroup.com]
Sent: 10 November 2003 3:00
To: curl-and-php_at_lists.sourceforge.net
Subject: curl,php4 windows 2000, xml

Hi all,

We're running in to situation where we need to use curl/php to post xml
data on a windows 2000 system. We've verifiied that php and curl are
working on the windows 2000 server but when we try:

<?php
$command = "curl -d \"$xmlFile\" http://<host to post to>";
exec($command,$response);
?>

The host we're trying to post to doesn't accept the $xmlFile. We can do
a curl -i http://<host to post to> successfully so we know the server
is alive and accepting curl commands (or at least the curl -i command).

Also, before putting this code on the windows 2000 server, it was
working on a Linux server. (The same host we're trying to post to
accepted the xml file just fine. The only thing that was different in
the linux environment is that we had to put single quotes around the
$xmlFile).

So, does anyone have any suggestions on how to overcome this?

TIA

-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/

**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
**********************************************************************

-------------------------------------------------------
This SF. Net email is sponsored by: GoToMyPC
GoToMyPC is the fast, easy and secure way to access your computer from
any Web browser or wireless device. Click here to Try it Free!
https://www.gotomypc.com/tr/OSDN/AW/Q4_2003/t/g22lp?Target=mm/g22lp.tmpl
Received on 2003-11-18