Jump to content


Member Since 06 Oct 2013
Offline Last Active Dec 14 2013 12:40 AM

Posts I've Made

In Topic: Ajax call error, var example is too long...

17 October 2013 - 05:53 PM


In Topic: Send an array using sockets

10 October 2013 - 06:28 PM

Solved. Thank you!

In Topic: Send an array using sockets

07 October 2013 - 09:22 PM

Thank you very much. Now finally works.

I create 3 pages: server.php, client.php and take_message,php.

I have a problem now only whit this my two-easy script(1:index.php, 2:client.php):

	function example(){
		type: "POST",
                 url: "../chat/client.php",
                 dataType: "html",
                  success: function(html){
$host = ''; $port = 25003; $message = $_POST['message'];

$socket = socket_create(AF_INET, SOCK_STREAM, 0) or die("Could not create socket\n");
socket_connect($socket, $host, $port) or die("Could not connect to server\n");

socket_write($socket, $message, strlen($message)) or die("Could not send data to server\n");

$result = socket_read ($socket, 1024) or die("Could not read server response\n");
echo $result;


All two work exactly, but the read page is very slowed. How can I keep the page client.php waiting for a value different from the previous one?

In Topic: Send an array using sockets

06 October 2013 - 07:28 PM

$json_decode = json_decode($json);
$array = array('one' => 'two');
$array_two = json_encode($array);
$array_three = json_decode($array_two);
array_push($json_decode, $array_three);

Same problem.

In Topic: Send an array using sockets

06 October 2013 - 06:27 PM

Thank you for response, i choose json_encode() and json_decode(). Last question:

$json = json_decode($json);
$array = array('one' => 'one');
$array= json_encode($array);
$array= json_decode($array);
array_push($json, $array);

Why array_push don't work?