Converter para Harbour

Converter para Harbour

Postby toya » Fri Dec 03, 2021 11:10 am

Alguém poderia me auxiliar converter para Harbour:

Este:
Code: Select all  Expand view
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://treinamento.atende.net/atende.php?pg=rest&service=WNERestServiceNFSe&cidade=migra_pinhais',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => array('XML'=> new CURLFILE('/H:/NFSe/S_NS9_000000003-nfSe.xml')),
  CURLOPT_HTTPHEADER => array(
    'Authorization: Basic MDkyNDczNDMwMDAxMjA6SXBtQDIwMjE='
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;


ou este:

Code: Select all  Expand view
POST /atende.php?pg=rest&service=WNERestServiceNFSe&cidade=migra_pinhais HTTP/1.1
Host: treinamento.atende.net
Authorization: Basic MDkyNDczNDMwMDAxMjA6SXBtQDIwMjE=
Content-Length: 196
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW

----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="XML"; filename="/H:/NFSe/S_NS9_000000003-nfSe.xml"
Content-Type: text/xml

(data)
----WebKitFormBoundary7MA4YWxkTrZu0gW
 


Mui grato...
toya
Ahora en la version 6.6
Consultoria e Desenvolvimento - NF-e/NFC-e
http://www.toyanet.com.br
https://www.facebook.com/profile.php?id=100009195956044
toyasis@gmail.com
FWH 10.8+PellesC+xHarbour.org 1.2.1
User avatar
toya
 
Posts: 38
Joined: Sat Dec 31, 2005 10:08 am
Location: Brasil

Re: Converter para Harbour

Postby toya » Fri Dec 03, 2021 6:51 pm

Já consegui autenticar...
Apenas não está anexando/enviando o arquivo XML...

Code: Select all  Expand view
   cUrl := "https://treinamento.atende.net/atende.php?pg=rest&service=WNERestServiceNFSe&cidade=migra_pinhais"
    cBasic := "MDkyNDczNDMwMDAxMjA6SXBtQDIwMjE="
    cFile := "H:\NFSe\S_NS9_000000003-nfSe.xml"
    cHost := "treinamento.atende.net"

    hDados["XML"] := '/H:/NFSe/S_NS9_000000003-nfSe.xml'
    aadd( aHeaders, 'Authorization: Basic MDkyNDczNDMwMDAxMjA6SXBtQDIwMjE=' )
    aadd( aHeaders, 'Cookie: PHPSESSID=n1ncgk2pelqls74rh07797atr1; cidade=migra_pinhais' )
    AAdd( aHeaders, 'Content-Disposition: form-data; name="XML"; filename='+cFile )

    curl_global_init()
    if !empty( hCurl := curl_easy_init() )
        curl_easy_setopt( hCurl, HB_CURLOPT_POST, 1 )
        curl_easy_setopt( hCurl, HB_CURLOPT_URL, cUrl )
        curl_easy_setopt( hCurl, HB_CURLOPT_ENCODING, ""  )
        curl_easy_setopt( hCurl, HB_CURLOPT_MAXREDIRS, 10  )
        curl_easy_setopt( hCurl, HB_CURLOPT_TIMEOUT, 0  )
        curl_easy_setopt( hCurl, HB_CURLOPT_FOLLOWLOCATION, 1)
        curl_easy_setopt( hCurl, HB_CURLOPT_HTTP_VERSION, HB_CURL_HTTP_VERSION_1_1 )
        curl_easy_setopt( hCurl, HB_CURLOPT_CUSTOMREQUEST, "POST"  )
        curl_easy_setopt( hCurl, HB_CURLOPT_POSTFIELDS, hDados["XML"] )
        curl_easy_setopt( hCurl, HB_CURLOPT_HTTPHEADER, aHeaders )
        curl_easy_setopt( hCurl, HB_CURLOPT_DL_BUFF_SETUP )
        cError := curl_easy_perform( hCurl )
        if !Empty( cError )
            MsgInfo( curl_easy_strerror( cError ), "Error cURL" )
        endif
        cRet  := curl_easy_dl_buff_get( hCurl )
        curl_easy_reset( hCurl )
    endif
    curl_global_cleanup()    

    ? cRet
 


retorno:
Code: Select all  Expand view
<?xml version="1.0" encoding="ISO-8859-1"?>
<retorno>
    <mensagem>
        <codigo>9999 - Arquivo XML da Nota Fiscal de Serviço Eletrônica não enviado!</codigo>
    </mensagem>
</retorno>
toya
Ahora en la version 6.6
Consultoria e Desenvolvimento - NF-e/NFC-e
http://www.toyanet.com.br
https://www.facebook.com/profile.php?id=100009195956044
toyasis@gmail.com
FWH 10.8+PellesC+xHarbour.org 1.2.1
User avatar
toya
 
Posts: 38
Joined: Sat Dec 31, 2005 10:08 am
Location: Brasil

Re: Converter para Harbour

Postby wilsongamboa » Fri Dec 03, 2021 9:56 pm

estimado no soy experto pero
hDados["XML"] := hb_jsonencode( memoread( '/H:/NFSe/S_NS9_000000003-nfSe.xml' ) )
saludos
Wilson
Wilson 'W' Gamboa A
Wilson.josenet@gmail.com
User avatar
wilsongamboa
 
Posts: 548
Joined: Wed Oct 19, 2005 6:41 pm
Location: Quito - Ecuador


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 64 guests