I have to send a string from an HTML page to a specific ip and port address using PHP.
Example: clicking on a button(on my HTML site) should result in sending the string "hello" to port 7474 of ip x.x.x.x.
How can i do that with PHP?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use fsockopen to open a connection to the port and get a filehandle, then use fwrite to write to that filehandle.
You’ll usually want to close the connection with fclose when you’re done. PHP will close the connection for you at the end of the script if you forget.