in Education by
I know that when we execute a PHP script on localhost, the server runs the code and does the required processing and simply outputs the result to the browser. Recently, I was reading about socket_create function which creates a connection for server and client to communicate, but I have a doubt regarding it. Below is what I think, please correct me if i am wrong. When I run my program (which uses socket_create) by typing http://localhost/myprog.php... The prog commands localhost to make a open a socket. This is ok, but what if I want to create socket on some other server? (Below are two options, please tell me which is correct) If I still run the script on http://localhost does that mean the script will run on localhost and localhost will make a socket on the other server? And if I want to give some input to the other server the input will pass through localhost. I can't do it as told above, I would have to run my script on other server to create a socket on it. JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
PHP script is like any other program on machine. If you access script which is on localhost, and this script creates socket then script on your local machine connect to the other server, retrieves output, pass it back to script. If you access some remote host, then script is executed on this remote host - that's only difference. So the answer is 1.

Related questions

0 votes
    How can I ask the user to enter a value during the execution of a GnuPlot script? I would like ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 17, 2022 in Education by JackTerrance
0 votes
    How do you handle a situation in which unexpected errors occur during the execution of a script?...
asked Oct 19, 2020 in Technology by JackTerrance
0 votes
    Specifically I have a PHP command-line script that at a certain point requires input from the user. I ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 19, 2022 in Education by JackTerrance
0 votes
    Specifically I have a PHP command-line script that at a certain point requires input from the user. I ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 18, 2022 in Education by JackTerrance
0 votes
    Specifically I have a PHP command-line script that at a certain point requires input from the user. I ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 17, 2022 in Education by JackTerrance
0 votes
    I'm trying to produce a page that would function a bit like a digital sticker album. My SQL ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 28, 2022 in Education by JackTerrance
0 votes
    I have one script and many websites, because they are on the same server how can I execute same ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 13, 2022 in Education by JackTerrance
0 votes
    I have one script and many websites, because they are on the same server how can I execute same ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 13, 2022 in Education by JackTerrance
0 votes
    how can i create a script in which i can search someone number and it will provide me name, country, email in an ... is used in this) Select the correct answer from above options...
asked Dec 23, 2021 in Education by JackTerrance
0 votes
    Php script to modify a webpage data and save it as another webpage Select the correct answer from above options...
asked Dec 20, 2021 in Education by JackTerrance
0 votes
    ________ are a set of rules that determine the execution of a transaction. A. Program B. Instruction C. Tables D. Contracts...
asked Feb 23, 2023 in Technology by JackTerrance
0 votes
    I got this question regarding web server (such as nginx, Cherokee or Oracle iPlanet) and Java containers ( ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Aug 1, 2022 in Education by JackTerrance
0 votes
    I have a web page that accepts an excel file, reads data from it and stores it in a buffer table ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 30, 2022 in Education by JackTerrance
0 votes
    Error:Execution failed for task ':app:dexDebug'. com.android.ide.common.process.ProcessException: org.gradle. ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 20, 2022 in Education by JackTerrance
0 votes
    I have been automating the creation of tables in Hana Db using HDBSQL and pyhdb now I want to do ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 8, 2022 in Education by JackTerrance
...