示例#1
0
        $response = curl_exec($session);
        header("Content-Type: application/xml");
        header(getStatusMessage("".curl_getinfo($session, CURLINFO_HTTP_CODE)));

        echo $response;
        curl_close($session);
        break;
      case 'HEAD':
        rest_head($request);
        break;
      case 'DELETE':
        rest_delete($request);
        break;
      case 'OPTIONS':
        rest_options($request);
        break;
      default:
        rest_error($request);
        break;
    }
} else {
   header("HTTP/1.0 400 Bad Request");
}

function secureUrl($method, $url) {
        $timestamp = time()*1000;
        $signature=sha1($method." ".$url." ".$timestamp." ".SPREADSHIRT_API_SECRET);
        $url.="?apiKey=".SPREADSHIRT_API_KEY."&sig=".$signature."&time=".$timestamp;
        return $url;
}
示例#2
0
            rest_put($table, $id, $db);
            break;
        case 'POST':
            rest_post($table, $id, $db);
            break;
        case 'GET':
            rest_get($table, $id, $db, $params);
            break;
        case 'HEAD':
            rest_head($table, $id, $db);
            break;
        case 'DELETE':
            rest_delete($table, $id, $db);
            break;
        case 'OPTIONS':
            rest_options($table, $id, $db);
            break;
        default:
            rest_error();
            break;
    }
}
function rest_put($table, $id = null, $db, $data)
{
    /*
    	PUT /shows/123		Updates data of show "123"
    	PUT /shows			Updates data of all shows
    */
    // Visitor counter has special method
    if ($table == 'visitors') {
        $update = $db->updateVisitorCount();