Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

PHP Extension Web API Examples

Primary Categories

ABN AMRO
AWS Secrets Manager
AWS Security Token Service
AWS Translate
Activix CRM
Adyen
Alibaba Cloud OSS
Amazon Cognito
Amazon DynamoDB
Amazon MWS
Amazon Pay
Amazon Rekognition
Amazon SP-API
Amazon Voice ID
Aruba Fatturazione
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Backblaze S3
Banco Inter
Belgian eHealth Platform
Bitfinex v2 REST
Bluzone
BrickLink
Bunny CDN
CallRail
CardConnect
Cerved
ClickBank
Clickatell
Cloudfare
Constant Contact
DocuSign
Duo Auth MFA
ETrade
Ecwid
Egypt ITIDA
Egypt eReceipt
Etsy
Facebook
Faire
Frame.io
GeoOp
GetHarvest
Global Payments
Google People
Google Search Console
Google Translate
Hungary NAV Invoicing
IBM Text to Speech
Ibanity
IntakeQ
Jira
Lightspeed
MYOB
Magento
Mailgun
Mastercard

MedTunnel
MercadoLibre
MessageMedia
Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Microsoft Teams
Moody's
Okta OAuth/OIDC
OneLogin OIDC
OneNote
OpenAI ChatGPT
PRODA
PayPal
Paynow.pl
Peoplevox
Populi
QuickBooks
Rabobank
Refinitiv
Royal Mail OBA
SCiS Schools Catalogue
SII Chile
SMSAPI
SOAP finkok.com
SendGrid
Shippo
Shopify
Shopware
Shopware 6
SimpleTexting
Square
Stripe
SugarCRM
TicketBAI
Trello
Twilio
Twitter API v2
Twitter v1
UPS
UniPin
VoiceBase
Vonage
WaTrend
Walmart v3
Wasabi
WhatsApp
WiX
WooCommerce
WordPress
Xero
Yahoo Mail
Yapily
Yousign
ZATCA
Zendesk
Zoom
_Miscellaneous_
eBay
effectconnect
hacienda.go.cr

 

 

 

(PHP Extension) SII POST boleta.electronica.envio

Almacenamiento de un conjunto de boletas en el SII

For more information, see https://www4c.sii.cl/bolcoreinternetui/api/

Chilkat PHP Downloads

PHP Extension for Windows, Linux, MacOS,
Alpine Linux, Solaris

<?php

// The version number (9_5_0) should match version of the Chilkat extension used, omitting the micro-version number.
// For example, if using Chilkat v9.5.0.48, then include as shown here:
include("chilkat_9_5_0.php");

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

$http = new CkHttp();

// Implements the following CURL command:

// curl -X POST "https://pangal.sii.cl/recursos/v1/boleta.electronica.envio" -H  "accept: application/json" 
//   -H  "User-Agent: Mozilla/4.0 ( compatible; PROG 1.0; Windows NT)"
//   -H  "Cookie: YZVQNQY4J5DT9" -H  "Content-Type: multipart/form-data"
//   -F "rutSender=1234" -F "dvSender=xyz" -F "rutCompany=9999" -F "dvCompany=abc"
//   -F "archivo=@starfish20.jpg;type=image/jpeg"

// Use the following online tool to generate HTTP code from a CURL command
// Convert a cURL Command to HTTP Source Code

$req = new CkHttpRequest();
$req->put_HttpVerb('POST');
$req->put_Path('/recursos/v1/boleta.electronica.envio');
$req->put_ContentType('multipart/form-data');
$req->AddParam('rutSender','66666666');
$req->AddParam('dvSender','6');
$req->AddParam('rutCompany','60803000');
$req->AddParam('dvCompany','K');

// Add an XML file that contains something like this:
//   <?xml version="1.0" encoding="ISO-8859-1"?>
//   <EnvioBOLETA version="1.0" xmlns="http://www.sii.cl/SiiDte" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sii.cl/SiiDte EnvioBOLETA_v11.xsd">
//     <SetDTE ID="SetDocB0T39_20201103_131999">
//       <Caratula version="1.0">
// ...
$xmlStr = '...';
$success = $req->AddStringForUpload2('archivo','envioBoleta.xml',$xmlStr,'ISO-8859-1','text/xml');

$req->AddHeader('Expect','100-continue');
$req->AddHeader('User-Agent','Mozilla/4.0 ( compatible; PROG 1.0; Windows NT)');
$req->AddHeader('Cookie','TOKEN=YZVQNQY4J5DT9');
$req->AddHeader('accept','application/json');
$req->AddHeader('Content-Type','multipart/form-data');

// For debugging, you can save the exact HTTP request sent and response received
// to a session log file:
$http->put_SessionLogFilename('someDir/sessionLog.txt');

// Use one of the following domains, depending on the environment:
// pangal.sii.cl  - Certification Environment
// rahue.sii.cl      - Production Environment
// resp is a CkHttpResponse
$resp = $http->SynchronousRequest('pangal.sii.cl',443,true,$req);
if ($http->get_LastMethodSuccess() == false) {
    print $http->lastErrorText() . "\n";
    exit;
}

$sbResponseBody = new CkStringBuilder();
$resp->GetBodySb($sbResponseBody);
$jResp = new CkJsonObject();
$jResp->LoadSb($sbResponseBody);
$jResp->put_EmitCompact(false);

print 'Response Body:' . "\n";
print $jResp->emit() . "\n";

$respStatusCode = $resp->get_StatusCode();
print 'Response Status Code = ' . $respStatusCode . "\n";
if ($respStatusCode >= 400) {
    print 'Response Header:' . "\n";
    print $resp->header() . "\n";
    print 'Failed.' . "\n";

    exit;
}

// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)

// {
//   "rut_emisor": "45000054-K",
//   "rut_envia": "83154595-0",
//   "trackid": 1014,
//   "fecha_recepcion": "2020-09-01 20:30:10",
//   "estado": "REC",
//   "file": "boleta-2020-09-01-001.xml"
// }

// Sample code for parsing the JSON response...
// Use the following online tool to generate parsing code from sample JSON:
// Generate Parsing Code from JSON

$rut_emisor = $jResp->stringOf('rut_emisor');
$rut_envia = $jResp->stringOf('rut_envia');
$trackid = $jResp->IntOf('trackid');
$fecha_recepcion = $jResp->stringOf('fecha_recepcion');
$estado = $jResp->stringOf('estado');
$file = $jResp->stringOf('file');

?>

 

© 2000-2024 Chilkat Software, Inc. All Rights Reserved.