I'm new to sending, receiving, and reading XML. I'm trying to send and receive XML data via cURL. I am using curl because it was so easy with just arrays. I am using the following code to generate the XML and the PHP script that is presently not working. It would be great if some great code god can explain whats wrong to me.
build_xml.php -
<?php
-
'<?xml version="1.0"?>'
-
$xml = "<member><name>name</name></member>";
-
echo $xml;
-
?>
-
Array Method - Works great with arrays. I tried with XML as $data, and it no work. Getting it working this way is preferred. -
<?php
-
exec("/usr/bin/curl -m 120 -d \"$xml\" http://www.example.com/index.php -L", $response);
-
// $response is null
-
?>
-
Alternate Method - This way is failing also. -
<?php
-
$url = "build_xml.php";
-
$ch = curl_init(); // initialize curl handle
-
curl_setopt($ch, CURLOPT_URL,$url); // set url to post to
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable
-
curl_setopt($ch, CURLOPT_TIMEOUT, 4); // times out after 4s
-
curl_setopt($ch, CURLOPT_POSTFIELDS, $XPost); // add POST fields
-
$result = curl_exec($ch); // run the whole process
-
echo $result; //contains response from server
-
// NO RESPONSE RECEIVED
-
?>
-
3 4032 pbmods 5,821
Recognized Expert Expert
Heya, empiresolutions .
build_xml.php -
<?php
-
'<?xml version="1.0"?>'
-
$xml = "<member><name>name</name></member>";
-
echo $xml;
-
?>
-
In this code, you're not actually outputting the XML header. Is this intentional?
Perhaps you meant to do this instead: -
<?php
-
$xml = '
-
<?xml version="1.0" encoding="utf-8"?>
-
<member>
-
<name>name</name>
-
</member>';
-
-
return $xml;
-
?>
-
Then in your main code: -
$xml = require('build_xml.php');
-
pbmods 5,821
Recognized Expert Expert
Heya, empiresolutions .
Glad to hear you got it working! Good luck with your project, and if you ever need anything, post back anytime :)
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Haluk Durmus |
last post by:
Hello
I checked out openssl,mm,apr,apr-util,apache 2,curl,libxml and php
from cvs.
php couse an ERROR
I did the following steps:
|
by: Stefan Richter |
last post by:
Hi, I would like to conect to a server by a SSL Conection,
to send an SMS.
The company that offers the SMS service provided some Code for a http
connection, but not for a https connection.
Here is the code to send an SMS by http, which works great.
Can you help / or do you know a good tutorial / website for php and
ssl ???
thanx,
|
by: Chris Fortune |
last post by:
# uname -a
Linux stargate.mxc-online.net 2.4.20-021stab022.2.777-smp #1 SMP Wed Jul 28
17:12:37
MSD 2004 i686 i686 i386 GNU/Linux
I recompiled PHP with mcrypt, openssl, and curl
phpinfo(): http://www.canadiandropshipping.com/hello.php3
Does anyone know why this ssl curl test fails?
http://www.canadiandropshipping.com...t/diag_curl.php
|
by: Edwin Rozie |
last post by:
Hey can U help me with the following?
I would like to send basic data (like a set of integers & strings) from
one php function to another php function.
Sounds easy, However, the functions are located on a different computer.
Or, said differently, I would like to use
function oncomp1($integer1, $string1, $string2)
|
by: yawnmoth |
last post by:
Is it possible to send http requests with curl but not have curl wait
for the response?
The reason I ask is because I'd like to code a web app that can sorta
start time consuming processes without the user having to wait. I'm
doing this (with fsockopen) by sending an http request to a page that
does the time consuming stuff and then immediatly closing, without
having read any of the response. This way, I don't have to wait for
the...
| |
by: nfhm2k |
last post by:
I've been trying to find a solution to this for quite some time now...
I even took a look at existing scripts...
Including this one...
http://groups.google.co.uk/group/comp.lang.php/browse_thread/thread/2e052386da903425/b03ec83ac55273a2?lnk=st&q=&rnum=1#b03ec83ac55273a2
Everyone on that post seems to say its to do with the cookie's, yet if
infact they had tried this script they would have found that even with
the cookies enabled this...
|
by: Miro |
last post by:
VB 2003
at the end of the code, this works great.
bytCommand = Encoding.ASCII.GetBytes("testing hello send text")
udpClient.Send(bytCommand, bytCommand.Length)
and this recieves it
Dim strReturnData As String = _
System.Text.Encoding.ASCII.GetString(receiveBytes)
|
by: existatus |
last post by:
In a form there are entries like this:
<input type="text" name="first_name" size="24" />
<input type="text" name="last_name" size="24" />
<input type="hidden" name="must_have" value="12345" />
<input type="hidden" name="recipient" value="myemail@comcast.net" />
<input type="hidden" name="redirect" value="http://mywebsite.com" />
<input type="hidden" name="subject" value="Topic In Question" />
|
by: lakmarket |
last post by:
Hi,
I am trying to send some querysting using cURL. This is the working
API
http://smpp4.routesms.com:8080/bulksms/bulksms?username=xxxxxxx&password=xxxxxxx&type=0&dlr=0&destination=94xxxxxxxxxx&source=testing&message=testmessage.
The infomation given by Routesms.com:
Port: 2345
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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 we have to send another system
| |