Наконец, я нашел решение, подобное этому:
public function register() {
$url = 'https://example.com/register';
$post_data="Email=frank@email.com";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded; charset=utf-8'));
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
$xml = simplexml_load_string($result,'SimpleXMLElement',LIBXML_NOCDATA);
header('Content-Type: application/json');
$temp = json_decode($xml);
$json = json_encode($temp[0]);
echo $json;
}
и оно работает;