Jump to content
Sign in to follow this  
penguine

How Access Cgi File Using Php?

Recommended Posts

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

What is your specific situation?

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...