#!/usr/bin/php -q ' . "\n"; $xml .= "\n"; $xml .= "view.execute\n"; $xml .= "\n"; $xml .= '' . "\n"; $xml .= "\n"; $xml .= "\n"; $xml .= "\n"; $xml .= "\n"; $xml .= '' . "\n"; $xml .= "\n"; $xml .= "\n"; $xml .= "\n"; $xml .= "\n"; $xml .= '' . "\n"; $xml .= "\n"; $xml .= "\n"; $xml .= "\n"; $xml .= "\n"; $xml .= '' . "\n"; $xml .= "\n"; $xml .= "\n"; $xml .= "\n"; $xml .= "\n"; $xml .= '' . "\n"; $xml .= "\n"; $xml .= "\n"; $xml .= "\n"; $xml .= "\n"; $xml .= "\n"; $xml .= ""; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_POSTFIELDS, $xml); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml; charset=utf-8', 'Content-Length: ' . strlen($xml))); $result = curl_exec($ch); $curlError = curl_error($ch); if ($curlError == '') { $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if ($httpCode == 200) { if ($result == '') { echo ("Void Response"); } else { $xml = simplexml_load_string($result); $retorno = array(); $retorno['codcli'] = $xml->params->param[1]->value->DOMElement->result->row->codcli; $retorno['codsercli'] = $xml->params->param[1]->value->DOMElement->result->row->codsercli; $retorno['plano'] = $xml->params->param[1]->value->DOMElement->result->row->plano; $retorno['endereco_i'] = $xml->params->param[1]->value->DOMElement->result->row->endereco_i; $retorno['bairro_i'] = $xml->params->param[1]->value->DOMElement->result->row->bairro_i; $retorno['cep_i'] = $xml->params->param[1]->value->DOMElement->result->row->cep_i; $retorno['cidade_i'] = $xml->params->param[1]->value->DOMElement->result->row->cidade_i; $retorno['uf_i'] = $xml->params->param[1]->value->DOMElement->result->row->uf_i; $retorno['codest'] = $xml->params->param[1]->value->DOMElement->result->row->codest; //$result = print_r($xml,true); } } else { echo ("HTTP error ocurred, number: $httpCode"); } } else { curl_close($ch); echo ("HTTP error ocurred: $curlError"); } return $retorno; }