WAPI – example in PHP

The following script requires the extension curl. Variables $login a $wpass substitute by login to your customer account and password to WAPI interface (a password that you have set in the WAPI settings it is not a customer account password).

// parameters of XML request
$login = 'tester';
$wpass = 'fdsaasdf';
$auth = sha1($login.sha1($wpass).date('H', time()));
$command = 'ping';
$cltrid = 'test_req_1';

// compilation of XML
$request = '<?xml version="1.0" encoding="UTF-8"?>

// address
$url = 'https://api.wedos.com/wapi/xml';

// POST data
$post = 'request='.urlencode($request);

// initialization cURL session
$ch = curl_init();

// setting URL and data POST 

// response we want as a return value curl_exec()

// timeout which the script waits for a response

// execution
$res = curl_exec($ch);

// listing results on output
echo '<pre>'.htmlspecialchars(print_r($res, true)).'</pre>';
Zpětná vazba je dočasně nedostupná, máte-li k návodu dotaz nebo připomínku, napište nám přes kontaktní formulář.