示例#1
0
 public function merge($expire)
 {
     $x = peb_encode("[~i]", array(array($expire)));
     $result = peb_rpc("phpcask", "merge", $x, $this->link);
     return peb_decode($result);
 }
<!DOCTYPE html>
<html lang="en">
<title>Twitter Everyday Hashtags Twitter</title>
  <head>
<?php 
$link = peb_connect("cat@food", "abc");
if (!$link) {
    //    die('Could not connect: ' . peb_error());
    Header("Location: http://site1.local/404.php");
}
$msg = peb_encode("[~s]", array(array("hello")));
//The sender must include a reply address.  use ~p to format a link identifier to a valid Erlang pid.
$result = peb_rpc("server", "tags_finland", $msg, $link);
$rs = peb_decode($result);
$msgS = call_user_func_array('array_merge', $rs);
if (count($msgS) > 1) {
    $tags = $msgS;
    $resultL = peb_rpc("server", "likes_finland", $msg, $link);
    $rsL = peb_decode($resultL);
    $likes = $rsL[0];
} else {
    Header("Location: http://site1.local/404.php");
}
peb_close($link);
?>
	  
	  
    <meta charset="utf-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">
<body>
<?php 
session_start();
mb_internal_encoding('UTF-8');
?>

<?php 
$word = $_SESSION['Test'];
$link = peb_connect("cat@food", "abc");
if (!$link) {
    //    die('Could not connect: ' . peb_error());
    Header("Location: http://site1.local/404.php");
    //echo'link error';
}
$msg = peb_encode("[~s]", array(array($word)));
//print_r($msg);
//The sender must include a reply address.  use ~p to format a link identifier to a valid Erlang pid.
$result = peb_rpc("server", "count_tags", $msg, $link);
$rs = peb_decode($result);
$msg = call_user_func_array('array_merge', $rs);
$arr = $msg;
$wo = array();
$indexF = array();
$num = array();
$x = 0;
$z = 0;
$length = count($arr);
for ($i = 0; $i < $length; $i++) {
    if ($i % 2 == 0) {
        $wo[$x] = mb_strtolower($arr[$i]);
</head>

<body>
<?php 
session_start();
?>

<?php 
$word = $_SESSION['Test'];
$word2 = $_SESSION['Test1'];
$link = peb_connect("cat@food", "abc");
if (!$link) {
    //    die('Could not connect: ' . peb_error());
    Header("Location: http://site1.local/404.php");
}
$msg = peb_encode("[~s,~s]", array(array($word, $word2)));
//The sender must include a reply address.  use ~p to format a link identifier to a valid Erlang pid.
$result = peb_rpc("server", "compare", $msg, $link);
$rs = peb_decode($result);
$msg = call_user_func_array('array_merge', $rs);
$Result1 = array_values($msg[0]);
$Result2 = array_values($msg[1]);
$wo = array();
$num = array();
$x = 0;
$z = 0;
$length = count($Result1);
for ($i = 0; $i < $length; $i++) {
    if ($i % 2 == 0) {
        $wo[$x] = $Result1[$i];
        $x++;
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
        <style type="text/css">
        ${demo.css}
        </style>
    </head>

<?php 
session_start();
$word = $_SESSION['Key'];
$range = (int) $_SESSION['range1'];
$link = peb_connect("cat@food", "abc");
if (!$link) {
    Header("Location: http://site1.local/404.php");
    //echo 'link error';
}
$msg = peb_encode("[~s~i]", array(array($word, $range)));
$result = peb_rpc("twitter_server", "getY", $msg, $link);
$rs = peb_decode($result);
$msg = call_user_func_array('array_merge', $rs);
$ret = array();
$fav = array();
//echo $range;
echo '<br/>';
$z = 0;
$x = 0;
for ($i = 0; $i < count($msg); ++$i) {
    if (is_array($msg[$i]) && count($msg[$i]) > 2) {
        $b = $msg[$i];
        $ret[$z] = $b[0] * -1;
        $fav[$x] = $b[1];
        $z++;
    $f = $msg[0] * -1;
    //print_r($f);
    //echo '<br/>';
    $s = $msg[1];
    //print_r($s);
    //echo '<br/>';
    $th = $msg[2];
    //print_r($th);
    //echo '<br/>';
    echo '<br/>';
}
if (count($msg) < 2) {
    Header("Location: http://site1.local/404.php");
    //echo'if(count($msg)<2)';
}
$msg2 = peb_encode("[~s]", array(array($word2)));
$result2 = peb_rpc("twitter_server", "getF", $msg2, $link);
$rs2 = peb_decode($result2);
$msg3 = call_user_func_array('array_merge', $rs2);
print_r($msg);
echo '<br/>';
if (count($msg3) > 2) {
    $f3 = $msg3[0] * -1;
    print_r($f3);
    echo '<br/>';
    $s3 = $msg3[1];
    print_r($s3);
    echo '<br/>';
    $th3 = $msg3[2];
    print_r($th3);
}
示例#7
0
<?php

/** NOTE this requires the use of the mypeb PHP extension http://code.google.com/p/mypeb/ **/
echo "\n\nRUNNING MYPEB Erlang Bridge Tests\n\n";
$link = peb_connect('erlnode', 'secret');
echo "The link is: " . $link;
if (!$link) {
    die('Could not connect: ' . peb_error());
}
$msg = peb_encode('[~a,~p,~s]', array("echo", array($link, 'getinfo'), "Hello World"));
//The sender must include a reply address.  use ~p to format a link identifier to a valid Erlang pid.
peb_send_byname('erlnode', $msg, $link);
$message = peb_receive($link);
$rs = peb_decode($message);
print_r($rs);
$serverpid = $rs[0][0];
peb_close($link);