/    Sign up×
Community /Pin to ProfileBookmark

Passing Variables in url includes.

Ok, I know this has to be some sort of ini settings, but here is the problem.

I want to include a like this

[code=php]require_once(“http://example.com/samplephpfileastext.inc”);[/code]

i can include the file no problem and its treats it as php included file no problem, but when i define a variable in the source file such as $foo and try to echo out the variable in the .inc file like

[code=php]echo “Foo is currently set to $foo”;[/code]

all that prints out is “Foo is currently set to”. Now if i change $foo to a defined value it will actually display what i set it as.

Anyone know what setting i have messed up that is not allowing the standard variables to pass? now i should also point out that if i try to include a local file the variables do pass through just fine.

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@sstalderMay 16.2008 — You cannot include a .inc file on a different domain (which it seems like your trying to do?) and get variables from the [B]PHP[/B].

Can you be more clear on what your trying to do?
Copy linkTweet thisAlerts:
@PyromanciauthorMay 16.2008 — The network i am working with has multiple locations. each locations consists of a Linux Box, and 2-3 Windows work stations. They all vpn in the main corporate location.

This script i am trying to make is a script is actually executed every minute. It suppose to query the master database then and look for any jobs scripts that need to be run for that machine. I was doing it this way since it be very easy for me to change and modify scheduled tasks for the computers with out having to take over each computer and interrupt and work a person might be doing.

so now that the background has been explained let me give you a shortened version of this script that will be executed.
[code=php]
<?php
$obo_computer_id = 1;
$obo_computer_key = "some random key";
$obo_debug = true;

$cronfile = "./currentlyproccessing.log";
$server = "http://192.168.0.0";
$domain = "myemaildomain.com";

require_once ( $server ."/client/cron.inc");

ProcessCron();
?>
[/code]


The in the cron.inc right now all i have is this:
[code=php]
<?php
echo " OK just checking values passed, <br /> target cron file is : ". $cronfile ."<br />target server is: ". $server ."<br /> and target domain is: " . $domain;

function ProcessCron()
{
//starts the checking for currently running jobs, and new jobs, etc.
}
?>
[/code]


Now if i run the orginal file all that prints out is:

[code=html]
OK just checking values passed,
target cron file is :
target server is:
and target shortdomain is:[/code]


Hopefully that explains a bit more.
Copy linkTweet thisAlerts:
@mUKMay 16.2008 — can you put script file in the same server what $cronfile is ?
Copy linkTweet thisAlerts:
@PyromanciauthorMay 19.2008 — here is the thing. the cron file exicutes just fine on a windows based machine, but cron file on the linux machine is the one with the problems. php is configured exactly the same on both.
×

Success!

Help @Pyromanci spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...