Posting XML with PHP using Zend Framework HTTP Client
PHP
2022-04-20 00:34 (4 years ago)

Here is the code to construct XML using SimpleXML in PHP and send a request using Zend Framework's HTTP Client:
$xml = new \SimpleXMLElement('<request/>');
$xml->addChild(
'partner',
$this->credentials['aaa']);
$order = $xml->addChild('order');
$order->addAttribute('order_id', $orderId);
$order->addChild('status', $status);
$client = new \Zend_Http_Client();
$client->setUri('https://....');
$client->setRawData($xml->asXML(), 'text/xml');
$response = $client->request('POST');
Please rate this article (No signup or login required)
Currently unrated
Related posts
Code to Validate Check Digits of JAN Codes in PHP
Using Vue.js Webpack Dev Server Proxy for Social Provider Authentication with Django + Python Social Auth
Remote Debugging via Reverse Port Forwarding with PHP SSH
PHP with Mac Brew: dlopen(/usr/local/opt/php56-intl/intl.so, 9): Library not loaded: /usr/local/opt/icu4c/lib/libicuuc.57.dylib
The author runs the application development company Cyberneura.
We look forward to discussing your development needs.
We look forward to discussing your development needs.