php and c++ working together
hi
just wondering what is the best way to make an executable, which opens up the default web browser and passes variables to a php script on my server.
basic example:
the user types in their name, the program stores it, opens up the default web browser and passes the variable to the php script and displays their name or takes a certain action.
I figured i could use
ShellExecute(NULL, "open", "http://www.mywebsite.com/executable.php?ID=1",NULL, NULL,SW_SHOWNORMAL);
but knowing more c++ than php, i don't know how to read the variables.
any ideas?
thanks in advance
jack
[edited by - iamwithstupid on January 25, 2003 7:26:56 AM]
January 25, 2003 08:39 AM
are you asking how to access the command line variables in php? if so, they will have already been defined, so just access them normally, e.g., " if ( $ID != 0 ) { " .
Yeh that is what i want to do, but it just doesn't seem to be working!
and here is the php script
As you can see ID is equal to 1 but it still says it works, it doesn't change unless i actually define id as something inside the actual php script.
Is there soemthing wrong with the way i am trying to pass the variable in the address?
thanks again
jack
[edited by - iamwithstupid on January 25, 2003 10:05:38 AM]
// the c++ file #include <windows.h>int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd){ ShellExecute(NULL, "open", "http://www.mywebsite.com/executable.php?ID=1",NULL, NULL,SW_SHOWNORMAL);return 0;}
and here is the php script
// test php file on the serverecho "Hello, this is a test area, which will hopefully do something exciting eventually!!!";if ($ID != 1) {echo "it worked";}else {echo "Not it didn't work";}?>
As you can see ID is equal to 1 but it still says it works, it doesn't change unless i actually define id as something inside the actual php script.
Is there soemthing wrong with the way i am trying to pass the variable in the address?
thanks again
jack
[edited by - iamwithstupid on January 25, 2003 10:05:38 AM]
January 25, 2003 09:23 AM
the problem could be in the ShellExecute call. you might try separating the params from the file. in other words,
ShellExecute(NULL, "open", "http://www.mywebsite.com/executable.php", "?ID=1", NULL, SW_SHOWNORMAL);
The problem is with your PHP script,
You first need to set your $ID variable with the value from the address.
$ID = $_GET["ID"];
should do the trick,
Have Fun
You first need to set your $ID variable with the value from the address.
$ID = $_GET["ID"];
should do the trick,
Have Fun
January 25, 2003 09:37 AM
do you have access to the server''s log files? the request should be in there, along with the params, if any. this would at least tell you whether the problem is on the client side or the server side (possibly; i''m assuming normal browsing works. )
i''d also suggest trying this with an explicit execution of your browser, with the entire address and params as the param string for ShellExecute.
i''d also suggest trying this with an explicit execution of your browser, with the entire address and params as the param string for ShellExecute.
January 25, 2003 09:40 AM
LowCalorieSoftDrink, i thought the web server''s php plugin did that? i guess i should have asked instead of assuming.
Yes
thanks LowCalorieSoftDrink and ap, it has finally worked
$ID = $_GET["ID"];, did the trick.
thanks alot
jack
thanks LowCalorieSoftDrink and ap, it has finally worked
$ID = $_GET["ID"];, did the trick.
thanks alot
jack
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement