[eluser]wahyusumartha[/eluser]
hello..
i have a problem while posting xml data to a url .....
could someone give me an example how to posting xml????
[eluser]Udi[/eluser]
Why you need to post XML data with URL??
What are you trying to do?
[eluser]wahyusumartha[/eluser]
i want to develop web service client with codeigniter.. so i have to post data with xml format...
for example :
i want to post this xml :
<customer>
<firstname>wahyu</firstname>
<lastname>sumartha</lastname>
</customer>
xml data above would be post to url (
http://example.com:9090/resource/customer/add)
could u help me how to do it ???
[eluser]wahyusumartha[/eluser]
Really ????
this url[
http://example.com:9090/resource/customer/add] consumes xml data..
so, i have to post xml ...
i think we can post xml data.. because i have been developing desktop application with that web service and worked properly
[eluser]Udi[/eluser]
Maybe you send it with regular POST and Form and then it builds the XML by itself.
[eluser]wahyusumartha[/eluser]
i have been solved the problem with using curl to post xml data
Thanks

[eluser]Udi[/eluser]
You mind sharing the code?
I'm trying to understand what you did and meant exactly.
[eluser]wahyusumartha[/eluser]
okay.. i will share the code

..
i want to post xml to web service server..
so i write controller like this :
function add_customer() {
$post = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n";
$post .= "<customer>\n";
$post .= "<firstname>sinichi</firstname>\n";
$post .= "<lastname>kudo</lastname>\n";
$post .= "</customer>\n";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,
"http://localhost:9090/TestRestful/resources/customersservice/add");
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$res = curl_exec($ch);
curl_close ($ch);
echo $res;
}
controller above have a function to post xml data to web service server using curl

..
are you understand my problem previously now ?
