Jump to content
Fivewin Brasil

Search the Community

Showing results for tags 'mdfe'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Categories

There are no results to display.

Forums

  • FiveWin
    • WorkShop
    • Advantage Server
    • FiveScript
    • FiveWin Avaliação
    • TopConnect
    • Classes
    • Programação
    • FiveWin - Conversão de 16 bits para 32 bits
    • Seminário
    • Artigos / Tutoriais
    • Off - Topic
  • Suporte Estendido
    • Duvidas Gerais

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 1 result

  1. BOA TARDE Precio buscar a averbação do Seguro para emisaão do MDFE via WEBService da Porto Seguro. Alguém ja desenvoiveu isso ? ou teria como com motar um exemplo para eu converter as fucnçoes PHP do exemplo para xharbour segue exemplo "... Exemplo em PHP (cURL) <?php /** * Open an url on https using curl and return content * @author hatem <info@phptunisie.net> * @param string url The url to open * @param string refer Referer (optional) * @param mixed usecookie If true, cookie.txt will be used as default, or the usecookie value. * @return string */ function open_https_url($url,$refer = "", $usecookie = false) { if ($usecookie) { if (file_exists($usecookie)) { if (!is_writable($usecookie)) { return "Can't write to $usecookie cookie file, change file permission to 777 or remove read only for windows."; } } else { $usecookie = ($usecookie === true)? "cookie.txt" : $usecookie; if (!touch($usecookie)) { return "Can't write to $usecookie cookie file, change file permission to 777 or remove read only for windows."; } } } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"); if ($usecookie) { curl_setopt($ch, CURLOPT_COOKIEJAR, $usecookie); curl_setopt($ch, CURLOPT_COOKIEFILE, $usecookie); } if ($refer != "") { curl_setopt($ch, CURLOPT_REFERER, $refer ); } curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); return $ch; } /** * Limpeza ao terminar de executar * Requer $ws */ function ws_shutdown(){ global $ws; if (file_exists($ws['cookie'])) { unlink($ws['cookie']); } } register_shutdown_function('ws_shutdown'); /** * Ajax Request * Requer $ws Global Config (comp/path/cookie) * aPost (array) json params * sModule (string) mod (i.e. login/Upload/Retrieve) * $sConn (string) URI to connect */ function websysRequest($aPost, $sModule = 'login', $sConn = 'http://www.averbeporto.com.br/websys/php/conn.php') { global $ws; if (!isset($aPost['comp'])) { $aPost['comp'] = $ws['comp']; } if (!isset($aPost['path'])) { $aPost['path'] = $ws['path']; } elseif ($aPost['path'] == '') { unset($aPost['path']); } $aPost['mod'] = $sModule; $ch = open_https_url($sConn, '', $ws['cookie']); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $aPost); $res = curl_exec($ch); curl_close($ch); return $res; } ?> Exemplo de Uso: <?php require_once('func.php'); // Exemplo Config $ws $ws = array( 'comp' => 5, 'path' => 'eguarda/php/', 'conn' => 'http://www.averbeporto.com.br/websys/php/conn.php', 'cookie' => tempnam(sys_get_temp_dir(), 'ws_'), 'logged' => '' ); /** * Envia arquivo * * @param {String} Conteudo do arquivo * @param {Array} Usuario e senha. Ex.: array('user'=>'USUARIO', 'pass'=>'SENHA', 'path'=>'') * @param {String} (optional) Remetente (em caso de email) * @return {Array} Retorna resposta do webservice */ function sendFile($sFileContent, $aUser, $sRecipient = ''){ global $ws; $file = tmpfile(); fwrite($file, $sFileContent); rewind($file); $meta = stream_get_meta_data($file); $mime = mime_content_type($meta['uri']); $post = array( 'file' => (version_compare(PHP_VERSION, '5.5') >= 0)? new CURLFile($meta['uri'], $mime) : '@'.$meta['uri'].';type='.$mime ); if ($sRecipient) { $post['recipient'] = $sRecipient; } // Login if ($ws['logged'] != $aUser['user']) { $res = json_decode(websysRequest($aUser), true); if (isset($res['logout']) && $res['logout']) { //ws_log('MAIL2EG: ['.$aUser['user'].']: '.posix_getpid().': Falha do login. '); } } else { $res['success'] = $res['C'] = true; } // Upload if ($res['success'] && isset($res['C'])) { $ws['logged'] = $aUser['user']; $res = json_decode(websysRequest($post, 'Upload'), true); } fclose($file); return $res; } $aUser = array( 'user' => 'USUARIO', 'pass' => 'SENHA', 'path' => '' ); $sFileContent = file_get_contents('ARQUIVO.xml'); $res = sendFile($sFileContent, $aUser); print_r($res); ?> ."" alguém teria um modelo mais ou menos parecido de como eu faria isso no xharbour Hoje eu fiz desta forma, o usuario envia o XML do CTE via email para a Porto Seguro, ele receber lá, depois o usuario entra no Site e copia o numero da averbação e depois digita no MDFE e envio, mas isso é muito trabalho pro usuario. Grato
×
×
  • Create New...