예제 #1
0
function alter_promo($promoid)
{
    $promo = new Promo($promoid);
    // We'll need to parse the PUT body to get our arguments
    $params = file_get_contents("php://input", "r");
    $putParams = array();
    while (preg_match("/&/", $params)) {
        $param = strstr($params, "&", true);
        $params = substr(strstr($params, "&"), 1);
        $putParams[strstr($param, "=", true)] = substr(strstr($param, "="), 1);
    }
    // We need it one more time for the last argument
    $param = $params;
    $putParams[strstr($param, "=", true)] = substr(strstr($param, "="), 1);
    $promo->setLibelle($putParams["libelle"]);
    $promo->write();
}