Example #1
0
<?php

include_once dirname(__FILE__) . "/config.php";
include_once dirname(__FILE__) . "/include/definitions.php";
include_once dirname(__FILE__) . "/include/nusoap.php";
define("NAMESPACE1", 'http://www.matstroeng.se/doma');
$server = createServer();
// Use the request to (try to) invoke the service
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);
function createServer()
{
    // *************************************************************************************
    // create the server instance
    // *************************************************************************************
    $server = new soap_server();
    $server->xml_encoding = "UTF-8";
    $server->decode_utf8 = false;
    $server->configureWSDL('DOMAService', NAMESPACE1);
    // *************************************************************************************
    // define complex types
    // *************************************************************************************
    $server->wsdl->addComplexType('PublishMapRequest', 'complexType', 'struct', 'all', '', array('Username' => array('name' => 'Username', 'type' => 'xsd:string'), 'Password' => array('name' => 'Password', 'type' => 'xsd:string'), 'MapInfo' => array('name' => 'Map', 'type' => 'tns:MapInfo')));
    $server->wsdl->addComplexType('PublishMapResponse', 'complexType', 'struct', 'all', '', array('Success' => array('name' => 'Success', 'type' => 'xsd:boolean'), 'ErrorMessage' => array('name' => 'ErrorMessage', 'type' => 'xsd:string'), 'URL' => array('name' => 'URL', 'type' => 'xsd:string')));
    $server->wsdl->addComplexType('PublishPreUploadedMapRequest', 'complexType', 'struct', 'all', '', array('Username' => array('name' => 'Username', 'type' => 'xsd:string'), 'Password' => array('name' => 'Password', 'type' => 'xsd:string'), 'MapInfo' => array('name' => 'Map', 'type' => 'tns:MapInfo'), 'PreUploadedMapImageFileName' => array('name' => 'PreUploadedMapImageFileName', 'type' => 'xsd:string'), 'PreUploadedBlankMapImageFileName' => array('name' => 'PreUploadedBlankMapImageFileName', 'type' => 'xsd:string'), 'PreUploadedThumbnailImageFileName' => array('name' => 'PreUploadedThumbnailImageFileName', 'type' => 'xsd:string')));
    $server->wsdl->addComplexType('PublishPreUploadedMapResponse', 'complexType', 'struct', 'all', '', array('Success' => array('name' => 'Success', 'type' => 'xsd:boolean'), 'ErrorMessage' => array('name' => 'ErrorMessage', 'type' => 'xsd:string'), 'URL' => array('name' => 'URL', 'type' => 'xsd:string')));
    $server->wsdl->addComplexType('UploadPartialFileRequest', 'complexType', 'struct', 'all', '', array('Username' => array('name' => 'Username', 'type' => 'xsd:string'), 'Password' => array('name' => 'Password', 'type' => 'xsd:string'), 'FileName' => array('name' => 'FileName', 'type' => 'xsd:string'), 'Data' => array('name' => 'Data', 'type' => 'xsd:base64Binary')));
    $server->wsdl->addComplexType('UploadPartialFileResponse', 'complexType', 'struct', 'all', '', array('Success' => array('name' => 'Success', 'type' => 'xsd:boolean'), 'ErrorMessage' => array('name' => 'ErrorMessage', 'type' => 'xsd:string'), 'FileName' => array('name' => 'FileName', 'type' => 'xsd:string')));
    $server->wsdl->addComplexType('GetAllMapsRequest', 'complexType', 'struct', 'all', '', array('Username' => array('name' => 'Username', 'type' => 'xsd:string'), 'Password' => array('name' => 'Password', 'type' => 'xsd:string')));
    $server->wsdl->addComplexType('GetAllMapsResponse', 'complexType', 'struct', 'all', '', array('Success' => array('name' => 'Success', 'type' => 'xsd:boolean'), 'ErrorMessage' => array('name' => 'ErrorMessage', 'type' => 'xsd:string'), 'Maps' => array('name' => 'Maps', 'type' => 'tns:MapInfoArray')));
    $server->wsdl->addComplexType('GetAllCategoriesRequest', 'complexType', 'struct', 'all', '', array('Username' => array('name' => 'Username', 'type' => 'xsd:string'), 'Password' => array('name' => 'Password', 'type' => 'xsd:string')));
Example #2
0
createServer(function ($request = array(), HttpResponse $r, $client) {
    parse_str(ltrim($request['QUERY_STRING'], "/?"), $params);
    $prior = microtime(true);
    file_put_contents("dat", $request['HEADERS']['BODY']);
    $request = BidRequest::parseFromString($request['HEADERS']['BODY']);
    $end = microtime(true);
    /** @var BidRequest $request */
    var_dump($request);
    try {
        $response = new BidResponse();
        $response->setProcessingTimeMs($end - $prior);
        $slots = $request->getAdslot();
        $ad = new BidResponse_Ad();
        $ad->setHtmlSnippet("<a href='%%CLICK_URL_UNESC%%http%3A%2F%2Fmy.adserver.com%2Fsome%2Fpath%2Fhandleclick%3Fclick%3Dclk'><img src='http://i.imgur.com/OJx87.png' width='120'/></a>");
        $ad->setBuyerCreativeId("my-creative-1234ABCD");
        $ad->appendVendorType(113);
        $ad->appendCategory(3);
        $ad->appendClickThroughUrl("http://www.google.com");
        $adslot = new BidResponse_Ad_AdSlot(array("id" => $slots[0]->getId(), "max_cpm_micros" => 1000));
        $ad->appendAdslot($adslot);
        $response->appendAd($ad);
        $response->setDebugString("Helo World");
        $r->writeHead(200, array("Content-Type" => "application/octet-stream"));
        $r->write($response->serializeToString());
        $r->end();
    } catch (Exception $e) {
        $r->writeHead(500, array("Content-Type" => "text/html"));
        $r->write("ERROR");
        $r->end();
        var_dump($e->getMessage());
        var_dump($e->getTraceAsString());
    }
})->listen($port);
Example #3
0
    $id = $_REQUEST['id'];
}
$form["internalName"] = $_REQUEST["internalName"];
$form["externalName"] = $_REQUEST["externalName"];
$form["status"] = $_REQUEST["status"];
$form["role"] = $_REQUEST["role"];
$form["pool"] = "";
// $_REQUEST["pool"];
if ($_REQUEST['action'] == 'delete') {
    header("Location: deleteserver.php?id={$id}");
    return;
}
if ($_REQUEST['action'] == 'update') {
    // Update a server; go back to serverlist.php
    updateServer($id, $form);
}
if ($_REQUEST['action'] == 'setup') {
    // Redirect to serverconf.php
    header("Location: serverconf.php?server={$form['internalName']}");
    return;
}
if ($_REQUEST['action'] == 'test') {
    // Redirect to serverconf.php
    header("Location: servertest.php?server={$form['internalName']}");
    return;
}
if ($_REQUEST['action'] == 'Add Server') {
    // Add new server; go back to serverlist.php
    $id = createServer($form);
}
header("Location: serverlist.php");
Example #4
0
/**
 * Start server
 * 
 * @global Ratchet\Server\IoServer $server
 */
function onRun()
{
    global $server;
    createServer();
    $server->run();
}
Example #5
0
    $provider_klass = new $provider_class($container);
    $kernel->registerProviders(array($provider_klass));
}
uv_timer_start($timer, SECONDS_MS, SECONDS_MS, array($processor, "process"));
createServer(function ($request = array(), \Chatwork\Server\HttpResponse $response, $client) use($kernel, $stat) {
    parse_str(ltrim($request['QUERY_STRING'], "/?"), $params);
    $peer = uv_tcp_getpeername($client);
    $request['peer'] = $peer;
    try {
        $result = $kernel->process($request, $params);
        $response->writeHead(200, array("Content-Type" => "text/plain"));
        $response->write($result);
        $response->end();
        $stat->increment("http.200");
    } catch (\Chatwork\Exception\RouteNotFoundException $e) {
        $response->writeHead(404, array("Content-Type" => "text/html"));
        $response->write("<h3>Not Found</h3>");
        $response->write("<div>" . $e->getMessage() . "</div>");
        $response->end();
        $stat->increment("http.404");
    } catch (Exception $e) {
        $response->writeHead(500, array("Content-Type" => "text/html"));
        $response->write("<h3>Server Error</h3>");
        $response->write($e->getMessage());
        $response->end();
        $stat->increment("http.500");
    }
})->listen($port);
uv_run();
function createServer(Closure $closure)
{
    $server = new \Chatwork\Server\HttpServer();
Example #6
0
<?php

require "http.php";
require "debug_timer.php";
createServer(function ($request, $response) {
    $response->writeHead(200, array("Content-Type" => "text/plain"));
    $response->write("Hello World");
    $response->end();
})->listen(8888);