Exemplo n.º 1
0
 public function __construct($node, $cookie)
 {
     $this->link = peb_connect($node, $cookie);
     if (!$this->link) {
         throw new Exception(sprintf("Can't connect to node: %s with cookie: %s", $node, $cookie));
     }
 }
<!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">
 " onBlur="if(this.value=='')this.value='Results for <?php 
echo $_GET['hashtag'];
?>
 '" onFocus="if
                    (this.value=='Results for <?php 
echo $_GET['hashtag'];
?>
 ')this.value='' "> 
                    
            <input class="btn btn-default" type="submit" value="Search Again!"/>
         </form>
        </div> <br>
        
<?php 
set_time_limit(0);
$link = peb_connect('Something@bryndlir-pinecone-2194177', 'abc');
if (!$link) {
    die('Could not connect' . peb_error());
}
$msg = peb_vencode('[~p,~a]', array(array($link, $_GET['hashtag'])));
peb_send_byname('pong', $msg, $link);
$message = peb_receive($link);
$rs = peb_vdecode($message);
$glans = call_user_func_array('array_merge', $rs);
$uses = $glans[1];
$twitter_id = $_SESSION["twitter_id"];
$theHashtag = $_GET['hashtag'];
//print_r($uses);
$query = "SELECT twitter_id FROM myhistory WHERE (twitter_id = '{$twitter_id}' AND hashtag = '{$theHashtag}')";
$doesExist = false;
$result = mysqli_query($db, $query);
Exemplo n.º 4
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);