Files
php-curl-class/examples/post_xml.php
T
2023-06-30 01:23:37 -07:00

31 lines
943 B
PHP

<?php
require __DIR__ . '/../vendor/autoload.php';
use Curl\Curl;
$data = '<?xml version="1.0" encoding="UTF-8"?>
<rss>
<items>
<item>
<id>1</id>
<ref>33ee7e1eb504b6619c1b445ca1442c21</ref>
<title><![CDATA[The Title]]></title>
<description><![CDATA[The description.]]></description>
<link><![CDATA[https://www.example.com/page.html?foo=bar&baz=wibble#hash]]></link>
</item>
<item>
<id>2</id>
<ref>b5c0b187fe309af0f4d35982fd961d7e</ref>
<title><![CDATA[Another Title]]></title>
<description><![CDATA[Some description.]]></description>
<link><![CDATA[https://www.example.org/image.png?w=1265.73&h=782.26]]></link>
</item>
</items>
</rss>';
$curl = new Curl();
$curl->setHeader('Content-Type', 'text/xml');
$curl->post('https://httpbin.org/post', $data);
var_dump($curl->response);