<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://bar-test.rmto.ir/TRNServiceV03.svc?wsdl');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$wsdl = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo 'HTTP Code: ' . $httpCode . PHP_EOL;
echo 'WSDL length: ' . strlen($wsdl) . PHP_EOL;
if (strlen($wsdl) > 0) {
    file_put_contents('rmto_wsdl.xml', $wsdl);
    echo 'WSDL saved' . PHP_EOL;
} else {
    echo 'Failed to download WSDL' . PHP_EOL;
}