<?php
/**
 * Created by PhpStorm.
 * User: freuddebian
 * Date: 15/10/18
 * Time: 13:39
 */


include '../database/Requester.php';

$tag="";

$postdata = file_get_contents("php://input");
$request=null;
if(isset($postdata)) {
    $request = json_decode($postdata);
}

if($postdata!=null && isset($request->tag)){
    $tag=$request->tag;
    switch ($tag) {
        case 'get_pas':
            getPasValue();
            break;
        case 'get_pub':
        getPubValue($request);
        break;
        default:
            echo json_encode(['error'=>4,'error_msg'=>'tag manquant']);

    }
}else{
    $res=[];
    $res['error']=-4;
    $res['msg']='aucun tag n a ete defini';
    $res['data']=$request;
    echo json_encode($res);
}
 function getPubValue($request){
    $req=new Requester(null);

    echo     $req->getPubValue($request->id_country);
}
function getPasValue(){
    $req=new Requester(null);

    echo     $req->getPasValue();
}

