开发者

Multipart form-data using zend framework

i am trying to use zend framework to post multipart/form-data , to send xml and files

$uri = 'http://...';

$update = new Zend_Http_Client();
$update->setUri($uri);
$update->setHeaders('Content-Type: multipart/form-data');

$xml = ' <man>'.
         '<man-id>12</man-id>'开发者_开发技巧.
         '<man-name>Smith</man-name>'.
         '<man-tall>186</man-tall>'.
       '</man>';

$response = $update->encodeFormData('a','file', $xml,'./src/server/TVP.jpg',array("Content-Transfer-Encoding" => "binary"));

How i can exactly use this function ( encodeFormData() ) to do this post ??? or if there any other way that i can use to post ???


To send XML you can use setRawData() like:

$xml = ' <man>'.
         '<man-id>12</man-id>'.
         '<man-name>Smith</man-name>'.
         '<man-tall>186</man-tall>'.
       '</man>';

$update->setRawData($xml);

This is in the Zend Framework Manual about half way down the page under "Sending Raw POST Data"

Hope this helps!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜