Now with SMS ! New
or create new account
Anveo API - PHP Code Sample


The following PHP code sample uses PEAR PHP library to post Anveo API XML Message over HTTP.
<?php
//--------------------------------------------------------------------------------------------------------
//                  PHP implementation of Anveo API to initiate DIAL.CONNECT API Action
//
//   The rest of Anveo API functions can be implemented by simply changing XML stored in $data variable
//                                          2008 - Anveo team.
//--------------------------------------------------------------------------------------------------------
require_once "HTTP/Request.php";

// ANVEO API Variables
$url = "https://www.anveo.com/api/v3.asp";
$data = '<?xml version="1.0" standalone="no" ?>
<REQUEST>
	<USERTOKEN>
		<USERKEY>----------- YOUR API USERKEY -----------</USERKEY>
	</USERTOKEN>
	<ACTION NAME="DIAL.CONNECT">
		<PARAMETER NAME="SSIGNATURE">'.hash_hmac('sha1', "some@email.com", "my secure phrase").'</PARAMETER>
		<PARAMETER NAME="TEST">TRUE</PARAMETER>
		<PARAMETER NAME="PHONENUMBER">1215215215</PARAMETER>
		<PARAMETER NAME="DESTPHONENUMBER">1212121212</PARAMETER>
		<PARAMETER NAME="CALLERID">12157010680</PARAMETER>
		<PARAMETER NAME="DELAY">1440</PARAMETER>
		<PARAMETER NAME="MEMO">DIAL.CONNECT API Action example to connect 1215215215 with 1212121212 delayed by 24 hours</PARAMETER>
	</ACTION>
</REQUEST>
';
$req =& new HTTP_Request($url);
$req->addHeader("Content-Type", "application/xml; charset=UTF-8");
$req->addHeader("Content-Length", strlen($data));
$req->addHeader("Accept", "application/xml; charset=UTF-8");
$req->setMethod(HTTP_REQUEST_METHOD_POST);
$req->addRawPostData($data, true);
$response=$req->sendRequest();
if (PEAR::isError($response)) {
   $result="";
   // HTTP ERROR. Use $response->getMessage(); to get detailed error description
}else{
   $result=$req->getResponseBody();
}

// $result holds API result in XML format
//echo $result;


?>
		
:.:
News Blog About Anveo Terms of Use FAQ Contact Us © 2017 Anveo Inc.