Questions tagged [php-socket]

PHP comes with a very capable socket programming API. These socket functions include almost everything you would need for socket-based client-server communication over TCP/IP, and can be easily deployed to build simple network applications.

More info here: https://php.net/manual/en/book.sockets.php

96 questions
0
votes
2 answers

PHP WebSocket Server can not access Origin and Referrer headers

I have a simple PHP websocket server Here is the full code : https://gist.github.com/hack4mer/e40094001d16c75fe5ae8347ebffccb7 while (true) { $changed = $clients; socket_select($changed, $null, $null, 0, 10); //check for new socket if…
Anand Singh
  • 1,091
  • 13
  • 21
0
votes
1 answer

How to open remote server socket php?

I am developing chat application using php and ajax . later I found get messages by ajax after X seconds doesn't efficient. I want to develop it by php socket . I opened the local server socket by example : php -f server.php My question is How…
moussa elenany
  • 61
  • 1
  • 1
  • 6
0
votes
0 answers

PHP Missing Output / Output no what I expected using echo "mail from:"; - output mail from:

I am having trouble with outputting the following: $i = "MAIL FROM:"; Attempting to connect to 'alt3.gmail-smtp-in.l.google.com' on port '25'... 220 mx.google.com ESMTP r64-v6si10402557pfd.37 - gsmtp MAIL FROM:502 5.5.1…
0
votes
1 answer

How to run PHP Port Listener Script with WAMP not PHP CLI?

I hope that I do not ask a spam question because I can not find any question about it. I write a socket port listener to listen an specific IP:PORT using PHP to receives TCP Packets from GPS Tracking Devices. When I run script with this…
user9072129
0
votes
0 answers

PHP TCP-Server to LUA TCP-Client - irregular freezes

I only code as a hobby with little experience, a year ago I found that the Digital Combat Simulator (DCS, a military flight-sim) had a powerfull lua scripting interface which enabled us to introduce gameplay into a plain simulator. It became evident…
0
votes
1 answer

PHP code (running in Compute Engine) for creating a listening socket on a specific port

I have written some code in PHP to create a socket and listen for incoming connections. I am trying to do this using a specific port I'm interested in. Everything is going well, except it opens the listening TCP socket on some random port, instead…
Chandrapal Yadav
  • 277
  • 1
  • 3
  • 9
0
votes
0 answers

PHP socket not working on windows 2012

I have PHP socket server working on one server. I have replicate the code and put it on another server(Windows server 2012 r2). I have changed few things e.g. localhost ip and port. when I run the file through cmd it doesn't do any thing. here is…
0
votes
1 answer

PHP Socket - How to re-use a socket connection?

i've the following situation: test.php > When that page is loaded i perform one post via Ajax to a second page (socket.php) socket.php > That page, receives the ajax request, and i create a socket (via php) to connect to a server (this is working).…
GuiPab
  • 455
  • 2
  • 7
  • 18
0
votes
1 answer

socket program is able to connect to the port which is still in TIME_WAIT

I have written a very simple socket server. It listens in post 63254. First i did a socket_create, socket_bind, socket_listen so here a connection is listening. Then in a loop i do the socket accpet. so here another listen. the read function reads…
Jayapal Chandran
  • 10,600
  • 14
  • 66
  • 91
0
votes
2 answers

PHP fsockopen client doesn't receive sent data

I have the following (stripped-down) piece of code: function curl_request_async($url, $params) { foreach ($params as $key => $val) { $post_params[] = $key.'='.urlencode($val); } $post_string = implode('&', $post_params); …
Lex
  • 293
  • 1
  • 5
  • 15
0
votes
1 answer

PHP: TCP sockets, 'unable to bind address'

i've seen other people with this problem, but maybe i can explain my situation and you can point out where the issue might be. im getting a 'Warning : socket_bind(): unable to bind address [98]: Address already in use' error. the situation is this.…
ThriceGood
  • 1,633
  • 3
  • 25
  • 43
0
votes
1 answer

php socket connection using localhost through Telnet

I been trying to create socket and bind it to the localhost 127.0.0.1 and trying to connect to it using Microsoft's telnet service, but where ever I connect to the specified address and port I get the following error. PHP Warning: socket_write():…
MaMba
  • 123
  • 11
0
votes
1 answer

Acknowledging Teltonika GPS Device after receiving IMEI using php

Hi please any one can explain how to send acknowledgment from server to Teltonika GPS device? The GPS device is sending IMEI (International Mobile Equipment Identity ) number and once I get IMEI number the packet is waiting for acknowledgment.
James Obuhuma
  • 397
  • 3
  • 8
  • 20
0
votes
1 answer

php-smpp Library not working and fails after two to three SMS

it is very first time i'm messing with sockets , and read many quotes that this is not for newbies. so problem is i'm using php smpp library for sending SMS which works fine but after delivering two to three SMS delivery fails with following…
0
votes
1 answer

Send SMS via PHP fwrite function in Linux

$filename = "/dev/ttyUSB4"; if (!$handle = fopen($filename, 'r+')) { echo "The device isn't detected"; exit; } else { if (fwrite($handle,"AT+CMGF=1\r")) { …