i_tester
Новичок
не работает обращение к веб сервисам через curl
веб-сервис должен возвращать значение суммы прописью. Говорит Couldn't resolve host '1s'. Много всего перепробывал (даже поиск по форумам).
Помогите пожалуйста. Чего написано не так?
веб-сервис должен возвращать значение суммы прописью. Говорит Couldn't resolve host '1s'. Много всего перепробывал (даже поиск по форумам).
Помогите пожалуйста. Чего написано не так?
PHP:
<?
$SOAPBody = '<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<RublesInWords xmlns="http://tempuri.org/">
<sum>123</sum>
</RublesInWords>
</soap:Body>
</soap:Envelope>';
$SOAPRequest = 'POST /v8webservice/service1.asmx HTTP/1.1
Host: 1s
Content-Type: text/xml; charset=utf-8
Content-Length: '.strlen($SOAPBody).'
SOAPAction: "http://tempuri.org/RublesInWords"
'.$SOAPBody;
$ch = curl_init("http://1s/v8webservice/service1.asmx?op=RublesInWords");
curl_setopt($ch, CURLOPT_HEADER, 0);
#curl_setopt($ch, CURLOPT_URL, "http://1s/v8webservice/service1.asmx?op=RublesInWords");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $SOAPRequest);
$xmlResponse = curl_exec($ch);
$curlError = curl_error($ch);
$curlErrno = curl_errno($ch);
echo $curlError.' - '.$curlErrno.'<br>';
if (!is_string($xmlResponse) || !strlen($xmlResponse)) {
echo( "Failure Contacting Server" );
} else {
echo $xmlResponse;
}
curl_close($ch);
?>