File "servicii.php"

Full path: /home/kosmetik/public_html/api/fan_courier/servicii.php
File size: 962 B
MIME-type: text/x-php
Charset: utf-8

Download   Open   Edit   Advanced Editor   Back

<?php

header('Content-type:application/json');
function get_services()
{
    $params = array('username' => $_REQUEST['username'], 'user_pass' => $_REQUEST['password'], 'client_id' => $_REQUEST['id_client']);
    $data = json_encode($params);
    $url = 'https://www.selfawb.ro/export_servicii_integrat.php';
    $c = curl_init($url);
    curl_setopt($c, CURLOPT_POST, true);
    curl_setopt($c, CURLOPT_POSTFIELDS, http_build_query($params));
    curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
    $run = curl_exec($c);
    curl_close($c);
    var_dump($run);
    exit;
    return $run;
}
if ($_SERVER["REQUEST_METHOD"] == "POST" && $_SERVER["CONTENT_TYPE"] == "application/json") {
    $data = trim(file_get_contents("php://input"));
    $json = json_decode($data, true);
    if (is_array($json)) {
        $_REQUEST = $json + $_REQUEST;
    }
    echo get_services();
} else {
    http_response_code(405);
}