How to post with xml file?

2012-06-06 Thread 88
Hi,

I want to post xml file to another site,I don't know that.
I try to make a sample, But that's a post request.

Anyone that can give me an example on how to make coding?

:Sample
$root = '?xml version=1.0 encoding=UTF-8 ?api-request
id=A/api-request';
$xml = new SimpleXMLElement($root);
$xml-addChild('id', $this-request-data['id']);
$xml-addChild('name', $this-request-data['name']);

App::uses('HttpSocket', 'Network/Http');
$HttpSocket = new HttpSocket();
$results = $HttpSocket-post('https://example.com/api/', array($xml-
asXML()));

Thanks
88

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


How to post with xml file?

2012-06-06 Thread 88
Hi,

I want to post xml file to another site,I don't know that.
I try to make a sample, But that's a post request.

Anyone that can give me an example on how to make coding?

:Sample
$root = '?xml version=1.0 encoding=UTF-8 ?api-request
id=A/api-request';
$xml = new SimpleXMLElement($root);
$xml-addChild('id', $this-request-data['id']);
$xml-addChild('name', $this-request-data['name']);

App::uses('HttpSocket', 'Network/Http');
$HttpSocket = new HttpSocket();
$results = $HttpSocket-post('https://example.com/api/', array($xml-
asXML()));

Thanks

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php