PHP and sockets
Moderator: General Moderators
PHP and sockets
hi,
I have a problem and want help about it.
I want to execute a php script by a sockt application(built in c++), this socket application passes socket information to the php code which stores this information into MYSQL database.
I want to know
1-) how an application(not web application) can call php script located on remote location.
2-) how php provide interface so that another application(not web application) can pass parameter to php function.
I hope you people can help me.
thanks
I have a problem and want help about it.
I want to execute a php script by a sockt application(built in c++), this socket application passes socket information to the php code which stores this information into MYSQL database.
I want to know
1-) how an application(not web application) can call php script located on remote location.
2-) how php provide interface so that another application(not web application) can pass parameter to php function.
I hope you people can help me.
thanks
-
kettle_drum
- DevNet Resident
- Posts: 1150
- Joined: Sun Jul 20, 2003 9:25 pm
- Location: West Yorkshire, England
-
kettle_drum
- DevNet Resident
- Posts: 1150
- Joined: Sun Jul 20, 2003 9:25 pm
- Location: West Yorkshire, England
-
kettle_drum
- DevNet Resident
- Posts: 1150
- Joined: Sun Jul 20, 2003 9:25 pm
- Location: West Yorkshire, England
The php file must be run by the php interupter which is generally used with a web server. To run the file you have to mimic a web browser - so you connect to the server with the php file on whatever port the web server is running on and pass any varaibles you want to give the script through either POST or GET in the http protocol. The php script can then get this variables by:
And you can therefor pass these variables around the php script as you wish.
Code: Select all
$_GET['some_var'];
$_POST['some_var'];for the lazy, unwilling to code a http1 implementation
Code: Select all
int main(void)
{
system("curl -d 'uid=myid&pwd=mypass&lang=en' https://kuleuven.ac.be/weblogin.cgi");
return 0;
}