Skip to end of metadata
Go to start of metadata

Project Moved

Icon

The PHP Client previously documented here has moved to FUSEForge

4 Comments

  1. The test page for the php client, Test.php, lacks feedback. Here is a version with more description of what is going right and wrong:

     <?php
    
     try {
    	require_once 'Stomp.php';
    
    	echo 'Creating StompConnection object... <br />';
    	$c = new StompConnection("127.0.0.1");  // requires Socket extension
    	echo 'Connecting with user/pass... <br />';
    	$result = $c->connect("hiram", "test");
    	print_r($result);
    
    	echo '<br />Subscribing... <br />';
    	$c->subscribe("/queue/FOO");
    	echo 'Sending message... <br />';
    	$c->send("/queue/FOO", "Hello World!");
    
    	// Wait for the message to come in..
    	echo 'Waiting for incoming message... <br />';
    	$result = $c->readFrame();
    	print_r($result);
    
    	$c->disconnect();
    
    	echo '<br />Finished';
    } catch (Exception $e) {
        echo 'Caught exception: ',  $e->getMessage(), "\n";
    }
    
    
    ?>
    
    
    
  2. The script Stomp.php requires the 'socket' extension (it was not on my Windows install). Add that extension if you cannot get past

        socket_create()
    
  3. The issue tracker appears to be misdirecting to iona.com, so I'll add this here for now:  There are deprecations in Stomp.php     

    Warning: Call-time pass-by-reference has been deprecated; If you would like to pass it by reference, modify the declaration of socket_recv(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\drupal\Stomp.php on line 156

    Warning: Call-time pass-by-reference has been deprecated; If you would like to pass it by reference, modify the declaration of socket_recv(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\drupal\Stomp.php on line 175

    Warning: Call-time pass-by-reference has been deprecated; If you would like to pass it by reference, modify the declaration of socket_recv(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\drupal\Stomp.php on line 185

  4. To fix the warnings above, change Stomp.php, removing the ampersand on the $b (buffer) arg in those lines. In other words, go from

            $rc = socket_recv($this->socket, &$b, 1, 0);
    

     to

            $rc = socket_recv($this->socket, $b, 1, 0);