PDA

View Full Version : "Throwing" a variable at an external file


cheekymonk3y
02-05-2007, 08:40 AM
The simpliest way that I can put what I want to do is: To throw a variable at an external file when i execute that variable. Here is an example:

File 1: a.php
$z = 'drupal';
File 2: b.php
print $z;
Now how would I submit $z to b.php by executing a.php in shell. I know how to execute a.php, I just dont know what code I must add to get $z "thrown" at b.php.

Please help, if i manage to do this, it will quite literally save me MONTHS of work. And you'll also be my friend forever.
Regards
Cheeky

noppid
02-05-2007, 01:30 PM
Do you mean this?

a.php

$z = 'drupal';
include('b.php');


b.php

print $z;

cheekymonk3y
02-05-2007, 05:35 PM
*sigh* nope, bascially what I want to do is similar to the html "post" method in forms, but it has to be in php because I am executing it via shell and have no access to html. File b.php is on someone elses server and i have no access to it so no includes. The closest thing that I can think of that might do this is spam bots that file out forms and such.

I have $POST1 and I want to "pass" it to b.php How would I do that inside a script?

EDIT: it would be the opposite of include() or require()

Cap'n Steve
02-06-2007, 03:10 AM
Why don't you want to include the other file? You could also pass arguments on the command line, but you'd have to look up how to read those in the second script.

cheekymonk3y
02-07-2007, 08:38 AM
nevermind, a guy at phpbuilder told me to check out the curl functions which is what i will be doing