Advertisement
Guest User

Untitled

a guest
Jul 29th, 2015
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. # XML DE SOLICITACAO
  2. $xml = '<distNFeRS versao="%s" xmlns="http://www.portalfiscal.inf.br/nfe">';
  3. $xml .= '<tpAmb>%s</tpAmb>';
  4. $xml .= '<verAplic>%s</verAplic>';
  5. $xml .= '<cUF>%s</cUF>';
  6. $xml .= '<CNPJ>%s</CNPJ>';
  7. $xml .= '<solRel>';
  8. $xml .= '<indXML>%s</indXML>';
  9. $xml .= '<indEmit>%s</indEmit>';
  10. $xml .= '<indDest>%s</indDest>';
  11. $xml .= '<ultNSU>%s</ultNSU>';
  12. $xml .= '</solRel>';
  13. $xml .= '<solDFe>';
  14. $xml .= '<chAcesso>%s</chAcesso>';
  15. $xml .= '<NSUSol>%s</NSUSol>';
  16. $xml .= '</solDFe>';
  17. $xml .= '</distNFeRS>';
  18.  
  19.  
  20. $this->xml = sprintf(trim($xml),
  21. $this->versao,
  22. $this->ambiente,
  23. 1,
  24. 43,
  25. $this->cnpjEmpresa,
  26. $this->indXML,
  27. $this->indEmit,
  28. $this->indDest,
  29. $this->ultNSU,
  30. $this->chaveAcesso,
  31. $this->NSUSol
  32. );
  33.  
  34. # CHAMA METODO DE ASSINATURA DE XML
  35. $this->signXml('distNFeRS');
  36.  
  37. $oCurl = curl_init();
  38. curl_setopt($oCurl, CURLOPT_CONNECTTIMEOUT, 10);
  39. curl_setopt($oCurl, CURLOPT_URL, $this->url.'');
  40. curl_setopt($oCurl, CURLOPT_PORT, 443);
  41. curl_setopt($oCurl, CURLOPT_VERBOSE, 1);
  42. curl_setopt($oCurl, CURLOPT_HEADER, 1);
  43. curl_setopt($oCurl, CURLOPT_SSLVERSION, 3);
  44. curl_setopt($oCurl, CURLOPT_SSL_VERIFYHOST, 2);
  45. curl_setopt($oCurl, CURLOPT_SSL_VERIFYPEER, 0);
  46. curl_setopt($oCurl, CURLOPT_SSLCERT, $this->NFePHP->certKEY);
  47. curl_setopt($oCurl, CURLOPT_SSLKEY, $this->NFePHP->priKEY);
  48. curl_setopt($oCurl, CURLOPT_POST, 1);
  49. curl_setopt($oCurl, CURLOPT_POSTFIELDS, $data);
  50. curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, 1);
  51. #curl_setopt($oCurl, CURLOPT_HTTPHEADER, $parametros);
  52. $xml = curl_exec($oCurl);
  53. $info = curl_getinfo($oCurl);
  54.  
  55. pr($xml);
  56. pr($info,1);
  57.  
  58. <distnfers xmlns="http://www.portalfiscal.inf.br/nfe" versao="1.10">
  59. <tpamb>2</tpamb>
  60. <veraplic>1</veraplic>
  61. <cuf>43</cuf>
  62. <cnpj>/** cnpj **/</cnpj>
  63. <solrel>
  64. <indxml>1</indxml>
  65. <indemit>7</indemit>
  66. <inddest>7</inddest>
  67. <ultnsu>0</ultnsu>
  68. </solrel>
  69. <signature xmlns="http://www.w3.org/2000/09/xmldsig#">
  70. /** signature **/
  71. </signature>
  72. </distnfers>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement