当前位置: 首页>>代码示例>>PHP>>正文


PHP sendData函数代码示例

本文整理汇总了PHP中sendData函数的典型用法代码示例。如果您正苦于以下问题:PHP sendData函数的具体用法?PHP sendData怎么用?PHP sendData使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了sendData函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: errorCheck

function errorCheck()
{
    //check for error
    global $return, $data_contact, $url_curl, $userpwd, $content, $to_error, $headers, $modify, $url_contacts, $entityID;
    $status = 'default';
    $status = get_string_between($return, 'status":"', '"');
    $errorMessage = get_string_between($return, 'message":"', '"');
    if ($status !== "ok") {
        if (begins_with($errorMessage, "A duplicate record has been found")) {
            $modify = 'True';
            //if contacts table
            if ($url_curl == $url_contacts) {
                $entityID = filter_var($errorMessage, FILTER_SANITIZE_NUMBER_INT);
            }
            $url_curl = $url_curl . '/' . $entityID;
            sendData();
        } else {
            //set email variables
            $subject = 'Error: Hobson Radius Form';
            $message = 'There has been an error on the Hobson Radious Form Submission
            
            Status: ' . $status . '
            ***Modify: ' . $modify . '
            ***Error: ' . $errorMessage . '
            ***url:' . $url_curl . '
            ***entityID:' . $entityID . '
            ***error return:' . $return . '
            
            data send:' . print_r($data_contact, true);
            //send email
            mail($to_error, $subject, $message, $headers);
        }
    }
}
开发者ID:paulstraw,项目名称:BCSR,代码行数:34,代码来源:functions.php

示例2: sendIdAndData

function sendIdAndData($data)
{
    if ($GLOBALS['is_sse']) {
        $id = $data['rows'][0]['id'];
        echo "id:" . json_encode($id) . "\n";
    }
    sendData($data);
}
开发者ID:Jonavin,项目名称:ssebook,代码行数:8,代码来源:fx_server.xhr.php

示例3: sendMessage

/**
 * Write a message to channel/user
 */
function sendMessage($socket, $channel, $msg)
{
    if (strlen($msg) > 2) {
        //Avoid sending empty lines to server, since all data should contain a line break, 2 chars is minimum
        $msg = prettify($msg);
        sendData($socket, "PRIVMSG {$channel} :{$msg}");
    }
}
开发者ID:fathkay,项目名称:VikingBot,代码行数:11,代码来源:functions.php

示例4: onData

 function onData($data)
 {
     if ($this->autoOpConfig['mode']) {
         if (strpos($data, 'JOIN :') !== false) {
             $bits = explode(" ", $data);
             $nick = getNick(@$bits[0]);
             $channel = trim(str_replace(":", '', @$bits[2]));
             if ($this->autoOpConfig['mode'] == 1) {
                 if (in_array($nick, $this->autoOpConfig['channel'][$channel])) {
                     sendData($this->socket, "MODE {$channel} +o {$nick}");
                 }
             } elseif ($this->autoOpConfig['mode'] == 2) {
                 sendData($this->socket, "MODE {$channel} +o {$nick}");
             }
         }
     }
 }
开发者ID:fathkay,项目名称:VikingBot,代码行数:17,代码来源:autoOpPlugin.php

示例5: onMessage

 function onMessage($from, $channel, $msg)
 {
     if (stringStartsWith($msg, "{$this->config['trigger']}op")) {
         $bits = explode(" ", $msg);
         $pass = @$bits[3];
         $who = @$bits[1];
         $where = @$bits[2];
         if (strlen($this->config['adminPass']) > 0 && $pass != $this->config['adminPass']) {
             sendMessage($this->socket, $channel, "{$from}: Wrong password");
         } else {
             if (strlen($who) == 0 || strlen($where) == 0) {
                 sendMessage($this->socket, $channel, "{$from}: Syntax: {$this->config['trigger']}op nick #channel [adminPassword]");
             } else {
                 sendData($this->socket, "MODE {$where} +o {$who}");
                 sendMessage($this->socket, $channel, "{$from}: OP has been attempted given, note that i must be OP myself to do it.");
             }
         }
     }
 }
开发者ID:nask0,项目名称:VikingBot,代码行数:19,代码来源:opPlugin.php

示例6: onMessage

 public function onMessage($from, $channel, $msg)
 {
     if (stringStartsWith($msg, "{$this->config['trigger']}upgrade")) {
         $bits = explode(" ", $msg);
         $pass = $bits[1];
         if (strlen($this->config['adminPass']) > 0 && $pass != $this->config['adminPass']) {
             sendMessage($this->socket, $channel, "{$from}: Wrong password");
         } else {
             $restartRequired = false;
             sendMessage($this->socket, $channel, "{$from}: Starting upgrade of bot and its plugins...");
             $response = trim(shell_exec("git pull"));
             if (empty($response)) {
                 sendMessage($this->socket, $channel, "{$from}: Error upgrading core. Check permissions!");
             } elseif ($response != 'Already up-to-date.') {
                 $restartRequired = true;
                 sendMessage($this->socket, $channel, "{$from}: Upgrading core: {$response}");
             }
             $coreDir = getcwd();
             $pluginsRecDirIterator = new RecursiveDirectoryIterator('./');
             foreach (new RecursiveIteratorIterator($pluginsRecDirIterator) as $gitDir) {
                 if (stringEndsWith($gitDir, ".git/..")) {
                     chdir($gitDir);
                     $response = trim(shell_exec("git pull"));
                     if (empty($response)) {
                         sendMessage($this->socket, $channel, "{$from}: Error upgrading sub git. Check permissions!");
                     } elseif ($response != 'Already up-to-date.') {
                         $restartRequired = true;
                         sendMessage($this->socket, $channel, "{$from}: Upgrading sub git: {$response}");
                     }
                     chdir($coreDir);
                 }
             }
             if ($restartRequired) {
                 sendMessage($this->socket, $channel, "{$from}: Restarting...");
                 sendData($this->socket, 'QUIT :Restarting due to upgrade');
                 die(exec('sh start.sh > /dev/null &'));
             } else {
                 sendMessage($this->socket, $channel, "{$from}: Everything up to date, not restarting.");
             }
         }
     }
 }
开发者ID:nask0,项目名称:VikingBot,代码行数:42,代码来源:upgradePlugin.php

示例7: onMessage

 function onMessage($from, $channel, $msg)
 {
     if (stringStartsWith($msg, "{$this->config['trigger']}upgrade")) {
         $bits = explode(" ", $msg);
         $pass = $bits[1];
         if (strlen($this->config['adminPass']) > 0 && $pass != $this->config['adminPass']) {
             sendMessage($this->socket, $channel, "{$from}: Wrong password");
         } else {
             sendMessage($this->socket, $channel, "{$from}: Starting upgrade...");
             $response = trim(shell_exec("git pull"));
             if ($response == 'Already up-to-date.') {
                 sendMessage($this->socket, $channel, "{$from}: The bot is already up to date, not restarting.");
             } else {
                 sendMessage($this->socket, $channel, "{$from}: {$response}");
                 sendMessage($this->socket, $channel, "{$from}: Restarting...");
                 sendData($this->socket, 'QUIT :Restarting due to upgrade');
                 die(exec('sh start.sh > /dev/null &'));
             }
         }
     }
 }
开发者ID:fathkay,项目名称:VikingBot,代码行数:21,代码来源:upgradePlugin.php

示例8: errorCheck

function errorCheck()
{
    /*check for error
      Hobson returns a string after form submission. We need to parse the string to determine the error. 
      */
    global $return, $data_contact, $url_curl, $userpwd, $content, $to_error, $headers, $modify, $url_contacts, $entityID;
    $status = 'default';
    $status = get_string_between($return, 'status":"', '"');
    $errorMessage = get_string_between($return, 'message":"', '"');
    //if we are ok, then there is not error and we can move on.
    if ($status !== "ok") {
        if (begins_with($errorMessage, "A duplicate record has been found")) {
            //The record already exists in the database, prepare to resubmit using the Modify/Put Method.
            $modify = 'True';
            //if contacts table
            if ($url_curl == $url_contacts) {
                $entityID = filter_var($errorMessage, FILTER_SANITIZE_NUMBER_INT);
            }
            $url_curl = $url_curl . '/' . $entityID;
            sendData();
        } else {
            //prepare variables for email
            $subject = 'Error: Hobson Radius Form';
            $message = 'There has been an error on the Hobson Radious Form Submission
            
            Status: ' . $status . '
            ***Modify: ' . $modify . '
            ***Error: ' . $errorMessage . '
            ***url:' . $url_curl . '
            ***entityID:' . $entityID . '
            ***error return:' . $return . '
            
            data send:' . print_r($data_contact, true);
            //send email
            mail($to_error, $subject, $message, $headers);
        }
    }
    //send email
    mail($to_error, $subject, $message, $headers);
}
开发者ID:pvidali,项目名称:BCSR-1,代码行数:40,代码来源:functions.php

示例9: header

include_once "fxpair.structured.php";
header("Content-Type: text/event-stream");
$symbols = array(new FXPair('EUR/USD', 1.303, 0.0001, 5, 360, 47), new FXPair('EUR/USD', 1.303, 0.0001, 5, 360, 47), new FXPair('USD/JPY', 95.09999999999999, 0.01, 3, 341, 55), new FXPair('AUD/GBP', 1.455, 0.0002, 5, 319, 39));
function sendData($data)
{
    echo "data:";
    echo json_encode($data) . "\n";
    echo "\n";
    @flush();
    @ob_flush();
}
$clock = microtime(true);
if (isset($argc) && $argc >= 2) {
    $t = $argv[1];
} elseif (array_key_exists('seed', $_REQUEST)) {
    $t = $_REQUEST['seed'];
} else {
    $t = $clock;
    sendData(array('seed' => $t));
}
mt_srand($t * 1000);
while (true) {
    $sleepSecs = mt_rand(250, 500) / 1000.0;
    $now = microtime(true);
    $adjustment = $now - $clock;
    usleep(($sleepSecs - $adjustment) * 1000000);
    $t += $sleepSecs;
    $clock += $sleepSecs;
    $ix = mt_rand(0, count($symbols) - 1);
    sendData($symbols[$ix]->generate($t));
}
开发者ID:Jonavin,项目名称:ssebook,代码行数:31,代码来源:fx_server.structured.php

示例10: elseif

            }
            break;
        default:
            $contactOwnerID = $coleenCoxID;
            break;
    }
} elseif ($countryLength >= 1) {
    $contactOwnerID = $sophieMettlerGroveID;
} else {
    $contactOwnerID = $coleenCoxID;
}
$fields["Contact Owner"] = $contactOwnerID;
/* 4. Create createFields array per web service requirement */
$data_contact = array("createFields" => $fields, "returnFields" => array("Entity ID", "Description"));
//define variables for specic curl event
$content = json_encode($data_contact);
$url_curl = $url_contacts;
//5. send data to Hobson
sendData();
if ($_POST['userRole'] !== 'Other') {
    $modify = 'False';
    //reset to default
    //get entity id from return string
    $entityID = get_string_between($return, 'Entity ID":', '}');
    $data_lifecycle = array("createFields" => array("Contact" => $entityID, "Lifecycle Role" => 'Inquirer', "Lifecycle Stage" => 'Open', "Primary Role" => 'True'));
    //define variables for specic curl event
    $content = json_encode($data_lifecycle);
    $url_curl = $url_lifecycles;
    //send data to Hobson
    sendData();
}
开发者ID:pvidali,项目名称:BCSR-1,代码行数:31,代码来源:form-submit.php

示例11: signalHandler

 function signalHandler($signal)
 {
     sendData($this->socket, "QUIT :Caught signal {$signal}, shutting down");
     logMsg("Caught {$signal}, shutting down\n");
     exit;
 }
开发者ID:fathkay,项目名称:VikingBot,代码行数:6,代码来源:VikingBot.php

示例12: sendHeaders

<?php

include_once "fx_server.auth.inc1.php";
sendHeaders();
if (!@$_SERVER['REMOTE_USER']) {
    sendData(array('action' => "auth", 'msg' => "System problem. Exiting."));
    exit;
}
include_once "fx_server.auth.inc2.php";
开发者ID:Jonavin,项目名称:ssebook,代码行数:9,代码来源:fx_server.auth.apache.php

示例13: trim

            if ($servers[$x]['id'] != 0) {
                if ($numadd == 0) {
                    if ($servers[$x]['path'] == 'true') {
                        $dusbody .= "URL=" . $servers[$x]['url'] . $line['URL'] . "\n";
                    } else {
                        $dusbody .= "URL=" . $servers[$x]['url'] . $line['fileDL'] . "\n";
                    }
                } else {
                    if ($servers[$x]['path'] == 'true') {
                        $dusbody .= "URL{$numadd}=" . $servers[$x]['url'] . $line['URL'] . "\n";
                    } else {
                        $dusbody .= "URL{$numadd}=" . $servers[$x]['url'] . $line['fileDL'] . "\n";
                    }
                }
                $numadd++;
            }
        }
        $dusbody .= "Size=" . $line['size'] . "\nFile=" . $line['file'] . "\nFileDL=" . $line['fileDL'] . "\nDate=" . $line['date'] . "\nRealSize=" . $line['realsize'] . "\nHash=" . $line['hash'] . "\n\n";
    }
}
$queryresult->close();
$dusheader .= "Result=OK\n";
$dusheader .= trim($dusupdates) . "\n";
$dusheader .= trim($dusupdatesuntable) . "\n";
$dusheader .= trim($dustranslations) . "\n";
$dusheader .= trim($dusservers) . "\n\n";
$dusbody = $dusheader . $dusbody;
// Closing MYSQL connection
$mysqli->close();
sendData($dusbody);
开发者ID:elbereth,项目名称:DragonUnPACKer,代码行数:30,代码来源:dus.php

示例14: sendData

                $url .= "&XDEBUG_SESSION_START=phpstorm";
            }
            $result = sendData($urlPostXML, $_POST["body"]);
            echo "<pre>";
            if (strpos($result, "<style") === false && strpos($result, "<hr>") === false) {
                echo htmlentities($result);
            } else {
                echo $result;
            }
            echo "</pre>";
            echo "<hr />";
            break;
        case "session":
            $urlSession = $_POST['urlSession'] . "&username=" . $_POST['userName'] . "&password=" . $_POST['passWord'];
            echo $urlPostXML, "<br />";
            $result = sendData($urlSession, "");
            print_r($result);
            echo "Test";
            break;
        default:
            break;
    }
} else {
    $urlPostXML = $default_urlPostXML;
    $_POST["body"] = "";
}
$debug_checked = isset($_POST["debug"]) ? " checked=\"checked\" " : "";
?>

<form action="<?php 
echo $_SERVER['PHP_SELF'];
开发者ID:juliogallardo1326,项目名称:fsc-bb,代码行数:31,代码来源:raw_api_post.php

示例15: rmsViewHistory

function rmsViewHistory($id, $pp, $lenght = 10, $offset = 0)
{
  global $sock;
  $result = array();

  $cmd = "HISTORY " . $id . "." . $pp . " " . $lenght . " " . $offset . "\r\n";
  sendData($cmd);

  $packet = socket_read($sock, 1024, PHP_NORMAL_READ);
  if (substr($packet, 0, 3) >= 400) {
    return false;
  }

  // kses input filtering
  $allowed = array('b' => array(),
      'i' => array(),
      'a' => array('href' => 1, 'title' => 1),
      'p' => array('align' => 1),
      'br' => array(),
      'font' => array('size' => 1, 'color' => 1, 'face' => 1)
      );

  while (!preg_match("/^231 /", $packet))
  {
    $msg = "";
    preg_match("/from (.*)/", $packet, $header);
    $from = $header[1];
    $packet = socket_read($sock, 1024, PHP_NORMAL_READ);
    $snttime = substr($packet, 12);

    $packet = socket_read($sock, 1024, PHP_NORMAL_READ);
    $packet = socket_read($sock, 1024, PHP_NORMAL_READ);

    while (!preg_match("/^223 /", $packet))
    {
      $msg .= (($msg!="")?"<br/>":"").$packet;
      $packet = socket_read($sock, 1024, PHP_NORMAL_READ);
    }

    if (get_magic_quotes_gpc())
      $msg = stripslashes($msg);

    $result[] = array('msg' => kses($msg, $allowed), 'time' => trim($snttime), 'from' => trim($from));

    $packet = socket_read($sock, 1024, PHP_NORMAL_READ);
  }
  return $result;
}
开发者ID:root42,项目名称:licq,代码行数:48,代码来源:rms.php


注:本文中的sendData函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。