Jump to content

How Access Cgi File Using Php?


penguine

Recommended Posts

file_get_contents("my_cgi_file.py"); //?

What is your specific situation?

Link to comment
Share on other sites

There is a cgi program running in some servers.I need to access and pass some function name to that program,that function is in a c++ program.If its successful the c++ return result and php get the result.This is the required situation.But unfortunately i could not establish these things.

Link to comment
Share on other sites

You could pass it the variable using GET, e.g.

file_get_contents("cgiscript.cgi?func=myfunc");

Link to comment
Share on other sites

That's not going to work, that's going to look for a file called cgiscript.cgi?func=myfunc. The correct way to pass a parameter to an application is usually separated by spaces:cgiscript.cgi valueA lof of them also use options with a dash or slash before them.wget -B -o out.log index.htmlIf you have a running application that you need to use, then that application needs to be built specifically to support what you're trying to do. You can't just execute any arbitrary function of any arbitrary running application (it doesn't even make sense to do that). If you have excel.exe running, you can't programmatically just tell it to save the document all of a sudden. The program needs to support that type of interaction, so it needs to be listening for it. One way is to use sockets, the program could open a socket and listen for connections on it, and if you want the program to do something then you connect and send it a command (i.e., exactly what a HTTP server does). Other methods include signal passing or using shared memory.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...