How to use this API

Published Thu 9 Sep, 15:35 by smalot in Tutorial

View part:


Part 4 - Send a file throw the AS2 protocol

Below an example to send a message :

 

<?php

// include AS2 lib
include_once('include.inc.php');

// generate on the fly a new file
$tmp_file = AS2Adapter::getTempFilename();
file_put_contents($tmp_file, "Hello guys, that's AS2Secure client test.");

// create a new message to send, from => to
$params = array('partner_from'  => 'mycompanyAS2',
                'partner_to'    => 'mendelsontestAS2');
$message = new AS2Message(false, $params);
$message->addFile($tmp_file);
$message->encode();

// create a client connexion and send the new message
$client = new AS2Client();
$result = $client->sendRequest($message);

// display all data returned, usefull for debugging
// only in SYNC mode, in ASYNC mode MDN
// is received throw another instance thanks to the web server
var_dump($result['response']);

 

.

0 Comments for "How to use this API"

There are currently no comments.

Leave a comment