Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open PHP socket onto some URL? (like www.ex.com:8080/mySock/)

Tags:

url

php

sockets

How to open PHP socket onto some URL? (like www.ex.com:8080/mySock/)

I want to send user to a user Chart Room 1 if ho goes to www.ex.com:8080/mySock/Chart1 and www.ex.com:8080/mySock/Chart2 to some other chart room if he goes into another (live php multy useres chart on sockets (Flash backend))

like image 751
Rella Avatar asked Dec 04 '25 15:12

Rella


1 Answers

You can use:

$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
socket_connect($socket, gethostbyname("www.ex.com"), 8080);

but are you sure you actually want a direct socket? If you clarify what you're actually doing, odds are PHP has some better way to accomplish it

like image 134
Michael Mrozek Avatar answered Dec 07 '25 03:12

Michael Mrozek



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!