SAAS-1229, SAAS-1230 - initial implementation of station suspend when over bandwidth limit

This commit is contained in:
Duncan Sommerville 2015-11-24 13:36:54 -05:00
parent 04167c103b
commit 82544f34d9
6 changed files with 64 additions and 0 deletions

View file

@ -53,6 +53,32 @@ class Application_Common_HTTPHelper
return $stationUrl;
}
/**
* Execute a cURL POST
*
* @param string $url the URL to POST to
* @param string[] $userPwd array of user args of the form ['user', 'pwd']
* @param array $formData array of form data kwargs
*
* @return mixed the cURL result
*/
public static function doPost($url, $userPwd, $formData) {
$params = "";
foreach($formData as $key=>$value) {
$params .= $key.'='.$value.'&';
}
rtrim($params, '&');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt($ch, CURLOPT_USERPWD, implode(':', $userPwd));
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
}
class ZendActionHttpException extends Exception {