How to POST XML data in codeigniter? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: How to POST XML data in codeigniter? (/showthread.php?tid=26282) |
How to POST XML data in codeigniter? - El Forum - 01-10-2010 [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???? How to POST XML data in codeigniter? - El Forum - 01-10-2010 [eluser]Udi[/eluser] Why you need to post XML data with URL?? What are you trying to do? How to POST XML data in codeigniter? - El Forum - 01-10-2010 [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 ??? How to POST XML data in codeigniter? - El Forum - 01-10-2010 [eluser]Udi[/eluser] You can't post XML data to url, URL grabs XML data or prints it. Is there any way that [http://example.com:9090/resource/customer/add] will grab the given XML? How to POST XML data in codeigniter? - El Forum - 01-11-2010 [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 How to POST XML data in codeigniter? - El Forum - 01-11-2010 [eluser]Udi[/eluser] Maybe you send it with regular POST and Form and then it builds the XML by itself. How to POST XML data in codeigniter? - El Forum - 01-11-2010 [eluser]wahyusumartha[/eluser] i have been solved the problem with using curl to post xml data Thanks How to POST XML data in codeigniter? - El Forum - 01-11-2010 [eluser]Udi[/eluser] You mind sharing the code? I'm trying to understand what you did and meant exactly. How to POST XML data in codeigniter? - El Forum - 01-11-2010 [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 ? |