PHP code example of greenterfin / ws
1. Go to this page and download the library: Download greenterfin/ws library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
greenterfin / ws example snippets
use Greenter\Ws\Services\SoapClient;
use Greenter\Ws\Services\BillSender;
$urlService = 'https://e-beta.sunat.gob.pe/ol-ti-itcpfegem-beta/billService';
$soap = new SoapClient($urlService);
$soap->setCredentials('20000000001MODDATOS', 'moddatos'); // usuario = ruc + usuario sol
$sender = new BillSender();
$sender->setClient($soap);
$xml = file_get_contents('factura.xml');
$result = $sender->send('20000000001-01-F001-1', $xml);
print_r($result);