Пример #1
0
<?php

set_time_limit(0);
$link = peb_pconnect("sadly-desktop@sadly-desktop", "secret");
if ($link) {
    echo "linked!:" . $link . "<br>\r\n";
} else {
    echo "error:" . peb_errorno() . "<br>\r\nerror:" . peb_error() . "<br>\r\n";
}
echo "<br>\r\n";
echo "<br>\r\n";
peb_status();
echo "<br>\r\n";
echo "<br>\r\n";
$x = peb_vencode("[~a,~a]", array(array("hello", "friend")));
echo "msg resource :" . $x . "\r\n";
echo "<br>\r\n";
echo "<br>\r\n";
peb_send_byname("pong", $x, $link);
echo "<br>\r\n";
echo "<br>\r\n";
//peb_close($link);  You don't need to close pconnect :)
<?php

set_time_limit(0);
$link = peb_pconnect("bryndlir@127.0.0.1 ", "abc");
if ($link) {
    echo "linked!:" . $link . "<br>\r\n";
} else {
    echo "error:" . peb_errorno() . "<br>\r\nerror:" . peb_error() . "<br>\r\n";
}
echo "<br>\r\n";
echo "<br>\r\n";
peb_status();
echo "<br>\r\n";
echo "<br>\r\n";
$x = peb_vencode("[~a,~a]", array(array("hello", "friend")));
echo "msg resource :" . $x . "\r\n";
echo "<br>\r\n";
echo "<br>\r\n";
peb_send_byname("pong", $x, $link);
echo "<br>\r\n";
echo "<br>\r\n";
//peb_close($link);  You don't need to close pconnect :)
<html>
    <head>

<?php 
$link = peb_pconnect("cat@food", "abc");
if (!$link) {
    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_sweden", $msg, $link);
sleep(5);
$rs = peb_decode($result);
$msgS = call_user_func_array('array_merge', $rs);
$tags = $msgS;
$resultL = peb_rpc("server", "likes_sweden", $msg, $link);
sleep(5);
$rsL = peb_decode($resultL);
$likes = $rsL[0];
?>
<p id="demo"></p>

<script type="text/javascript">
// use php implode function to build string for JavaScript array literal
var wordJ = <?php 
echo '["' . implode('", "', $tags) . '"]';
?>
;

var s = <?php 
echo (int) $likes;