Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Quando informo os dados do clientes, dá a mensagem abaixo. Alguem sabe como solucionar?
Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /var/www/zzzzzzzz/html/xxxxx/carrega_.php:32 Stack trace: #0 /var/www/zzzzzz/html/xxxxxx/teste_.php(32): SimpleXMLElement->__construct('') #1 {main} thrown in /var/www/zzzzzzzz/html/xxxxx/teste_.php on line 32
<?php
$_POST['codigo'] = (int) $_POST['codigo'];
$_POST['digito'] = (int) $_POST['digito'];
if ((is_int($_POST['codigo']) && $_POST['codigo'] != 0) && is_int($_POST['digito'])) {
$fp = fsockopen("000.000.00.000", 00, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
$out = "POST /ws.asmx/Consulta HTTP/1.1\r\n";
$out .= "Host: 000.000.00.000\r\n";
$out .= "Content-Type: application/x-www-form-urlencoded\r\n";
$out .= "Content-Length: xxxlen\r\n\r\n";
$tudo .= "Parametros=<sdtconweb xmlns=\"\">\r\n <CodCliente>" . $_POST['codigo'] . "</CodCliente>\r\n <DigCliente>" . $_POST['digito'] . "</DigCliente>\r\n</sdtconweb> \r\n";
$out .= $tudo;
$out = str_replace('xxxlen',strlen($tudo)-3,$out);
fwrite($fp, $out);
$xml = '';
while (!feof($fp)) {
$xml .= fgets($fp, 128);
}
fclose($fp);
}
$xml = substr($xml,strpos($xml,'<string xmlns="http://tempuri.org/xxxxxxxxxx/ws">')+strlen('<string xmlns="http://tempuri.org/xxxxxxxxxx/ws">'));
$xml = substr($xml,0,strpos($xml,'</string>'));
$xml = html_entity_decode($xml);
$xml = new SimpleXMLElement($xml);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>xxxxx</title>
<script type="application/javascript">
function popup(end,npop,larg,alt) {
window.open(end, npop, 'status=yes,height='+alt+',width='+larg+',top='+(window.screen.height/2-alt/2)+',left='+(window.screen.width/2-larg/2));
}
function validar() {
return true;
if (!isNaN(document.getElementById('codigo').value) || document.getElementById('codigo').value == '') {
alert('Digite um código válido!');
document.getElementById('codigo').focus();
return false;
}
if (isNaN(document.getElementById('digito').value) || document.getElementById('digito').value == '') {
alert('Digite um digito válido!');
document.getElementById('digito').focus();
return false;
}
}
</script>
<style type="text/css">
body{
background: url(imagens/fundo.jpg) center top no-repeat;
margin-top: 100px;
}
* {Carregando comentários...