Example #1
0
function createProcedures($mysqli, $api_data)
{
    foreach ($api_data as $entry) {
        $procedure = $entry->procedure;
        $proc_params = getInputParams($entry);
        print_r($entry->procedure->proc_name);
        print_r(": \n");
        print_r($proc_params);
        print_r("\n\n\n");
        if (isset($proc_params) && isset($procedure->proc_body)) {
            $sql_drop = 'DROP PROCEDURE IF EXISTS ' . $procedure->proc_name . "; \n";
            $sql_create = "CREATE PROCEDURE " . $procedure->proc_name . "(" . $proc_params . ") " . "BEGIN \n" . $procedure->proc_body . " \nEND; \n\n";
            if (!$mysqli->query($sql_drop) || !$mysqli->query($sql_create)) {
                return false;
            }
        }
    }
    return true;
}
Example #2
0
     if (isset($_GET["name"])) {
         $query = "http://dev.markitondemand.com/MODApis/Api/v2/Lookup/json?input=" . urlencode($_GET["name"]);
         $result = file_get_contents($query) or die("Unable to retrieve values from Market on Demand");
         echo $result;
     }
 } else {
     if (isset($_GET["operation"]) && $_GET["operation"] == "getstock") {
         if (isset($_GET["symbol"])) {
             $query = "http://dev.markitondemand.com/MODApis/Api/v2/Quote/json?symbol=" . urlencode($_GET["symbol"]);
             $result = file_get_contents($query) or die("Unable to retrieve values from Market on Demand");
             echo $result;
         }
     } else {
         if (isset($_GET["operation"]) && $_GET["operation"] == "charts") {
             if (isset($_GET["symbol"])) {
                 $query = "http://dev.markitondemand.com/MODApis/Api/v2/InteractiveChart/json?parameters=" . urlencode(getInputParams($_GET["symbol"], $_GET["duration"], $_GET["period"]));
                 $result = file_get_contents($query) or die("Unable to retrieve values from Market on Demand");
                 echo $result;
             }
         } else {
             if (isset($_GET["operation"]) && $_GET["operation"] == "news") {
                 if (isset($_GET["symbol"])) {
                     $query = "https://ajax.googleapis.com/ajax/services/search/news?v=1.0&userip=173.194.204.141&q=" . urlencode($_GET["symbol"]);
                     $result = file_get_contents($query) or die("Unable to retrieve values from Market on Demand");
                     echo $result;
                 }
             } else {
                 if (isset($_GET["operation"]) && $_GET["operation"] == "bingnews") {
                     if (isset($_GET["symbol"])) {
                         $accountKey = 'dwO9E9fD4soMHF83khoFbhWoSdMSvqYjsj9cfAnUSFM';
                         $ServiceRootURL = 'https://api.datamarket.azure.com/Bing/Search/v1/';