use a local php script to execute a remote php script and return results?Basically, can I execute a php script from within a php script? Heres
some details:
I'm using a remote script to get my local ip address using
$HTTP_SERVER_VARS['REMOTE_ADDR'];
This works. Now I want to run a local php script to call the remote
script and return my ip address. Any Ideas? Thanks! -bp
"miles111" <plasters@pilot.msu.edu> wrote in message
news:e7c39001.0401202144.28de85c6@posting.google.com...
> Basically, can I execute a php script from within a php script? Heres
> some details:
>
> I'm using a remote script to get my local ip address using
> $HTTP_SERVER_VARS['REMOTE_ADDR'];
>
> This works. Now I want to run a local php script to call the remote
> script and return my ip address. Any Ideas? Thanks! -bp
>
Why not use $_SERVER['SERVER_ADDR']?
Regarding this well-known quote, often attributed to miles111's famous "20
Jan 2004 21:44:16 -0800" speech:
> Basically, can I execute a php script from within a php script? Heres
> some details:
>
> I'm using a remote script to get my local ip address using
> $HTTP_SERVER_VARS['REMOTE_ADDR'];
>
> This works. Now I want to run a local php script to call the remote
> script and return my ip address. Any Ideas? Thanks! -bp
Just use a GET redirect (Assuming you're running Apache+php on your local
system):
To get an IP from local to remote (in a script running locally):
header("Locat...
PHP Training Institute In Delhi, Live Projects on PHP. Short Term PHP Courses, PHP Scripts, PHP Training with Live Projects.Vserve Global offers short term PHP: Hypertext Preprocessor Training
Course, which is a widely used, general-purpose scripting language
that was originally designed for web development, to produce dynamic
web pages. It can be embedded into HTML and generally runs on a web
server, which needs to be configured to process PHP code and create
web page content from it. It can be deployed on most web servers and
on almost every operating system and platform free of charge.PHP is
installed on over 20 million websites and 1 million web servers.
TOPICS:-
>> Core PHP Language
>> HTML, Cascad...
PHP CGI script to PHP CLI scriptThis is my problem:
I'm using PEAR package Spreadsheet_Excel_Writer to generate Excel
files. Everything works fine on my test server and several production
servers. But on one production server, generated Excel won't open (and
data is actually in it).
I can't figure out what's causing the problem (only difference is PHP
version 5.1.6 vs 5.2, other required PEAR packages are identical), but
I did notice during my investigation that Excel file generates and
opens without problem if I execute script from command line (I use
dummy PHP script with basic things needed to m...
what is wrong with this script and how do I get the value in a php scriptwhat is wrong with this script and how do I get the value Rij1 and Rij2 and Rij3 and Rij4 and Rij5 and Rij6 in a php script
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.IN)
GPIO.setup(18, GPIO.IN)
GPIO.setup(21, GPIO.IN)
GPIO.setup(22, GPIO.IN)
GPIO.setup(23, GPIO.IN)
GPIO.setup(24, GPIO.IN)
Rij1 = 0
Rij2 = 0
Rij3 = 0
Rij4 = 0
Rij5 = 0
Rij6 = 0
while True:
PRij1 = GPIO.input(17)
PRij2 = GPIO.input(18)
PRij3 = GPIO.input(21)
PRij4 = GPIO.input(22)
PRij5 = GPIO.input(23)
PRij6 = GPIO.input(24)
if (PRij1 == False):
Rij1 = Rij1...
How to invoke remote php file from php?Hi, I have a local php file and I need to get info back from php file
on the server. How do I invoke remote a php? I can access this remote
php thru a simple url and it prints some info on the web page. How do I
get this info back to store as a variable in local php?
Regards,
Alex.
Alex wrote:
> Hi, I have a local php file and I need to get info back from php file
> on the server. How do I invoke remote a php? I can access this remote
> php thru a simple url and it prints some info on the web page. How do I
> get this info back to store as a variable in local php?
>
> Regards,
> Alex.
>
See example 16-11 here:
http://www.php.net/manual/en/function.include.php
Alex wrote:
>
> I have a local php file and I need to get info back from php file
> on the server. How do I invoke remote a php? I can access this remote
> php thru a simple url and it prints some info on the web page. How do I
> get this info back to store as a variable in local php?
$info = file_get_contents('http://remoteserver.com/script.php');
Cheers,
NC
Carl & NC,
Thank you very much!!! Both examples work great.
Not precisely sure what you mean, something simple like this might do
what you want:
$contents =
file_get_contents('http://www.site.com/alexs_page.php?param=1&id=2');
NC wrote:
> Alex wrote:
>
>>I have a local php file and I need to get info back from php file
>>on the server. How do I invoke remote a php? I...
i am getting the php coding while running the php..i have information.php file that file contain following coding <?php
echo phpinfo(); ?>
while i calling the URL ("http://localhost/information.php").
i am getting the coding <?php echo phpinfo(); ?>
not show the php information...... i am new to the php can you help me?
<mekalai82@gmail.com> wrote in message
news:ea7db46d-a03d-497a-b38b-c54d75f266f8@h11g2000prf.googlegroups.com...
>i have information.php file that file contain following coding <?php
> echo phpinfo(); ?>
> while i calling the URL ("http://localhost/information.php").
>
> i am getting the coding <?php echo phpinfo(); ?>
<?php phpinfo(); ?>
--
Richard
On Feb 29, 11:30 am, "rf" <r...@invalid.com> wrote:
> <mekala...@gmail.com> wrote in message
>
> news:ea7db46d-a03d-497a-b38b-c54d75f266f8@h11g2000prf.googlegroups.com...
>
> >i have information.php file that file contain following coding <?php
> > echo phpinfo(); ?>
> > while i calling the URL ("http://localhost/information.php").
>
> > i am getting the coding <?php echo phpinfo(); ?>
>
> <?php phpinfo(); ?>
>
> --
> Richard
for example i have that coding.......my coding is run in the some
other machine. but while i am trying in my system i am getting the
whatever i have typed in file.... that content will be
displaying......... does not provide the result of that file
coding.......
Calling (non-php) scripts from inside PHPIn my php page I am calling a Python cgi. The problem is that
originally the Python script was being called directly and it could
access the environment variables that were being set. Now since the
php script is being called first it has access to the environment
variables, but the Python script does nt.
How can I forward the variables or call the Python script in such a
way where it can access those variables?
These are the type of environment variables I am talking about
$_SERVER['HTTP_OBREQUESTEDURL']
In my php script (which is a web page) I was calling the Python cgi
like this.
$output=shell_exec("../cgi-bin/setaccess.cgi"." 2>&1"); //system call
print $output;
Greetings, Anthony Smith.
In reply to Your message dated Wednesday, December 12, 2007, 22:30:55,
> In my php page I am calling a Python cgi. The problem is that
> originally the Python script was being called directly and it could
> access the environment variables that were being set. Now since the
> php script is being called first it has access to the environment
> variables, but the Python script does nt.
> How can I forward the variables or call the Python script in such a
> way where it can access those variables?
> These are the type of environment variables I am talking about
> $_SERVER['HTTP_OBREQUESTEDURL']
> In my php script (which is a web page) I was calling the Python cgi
> like this.
> $output=shell_exec(".....
Will Old PHP scripts Run on New PHP?Does old PHP scripts forwards compatible with newer PHP release?
> Does old PHP scripts forwards compatible with newer PHP release?
that really depends on many things for example the set up of php, which
functions are used etc
Deal Finder <hosting@us.us> wrote or quoted:
> Does old PHP scripts forwards compatible with newer PHP release?
Not in general. My experience has been that changing PHP versions
often casues headaches, if it hasn't been well planned for in advance.
The problems are usually easy to fix, but it can still be a lot more
painful than is desirable.
--
__________
|im |yler http://timtyler.org/ tim@tt1lock.org Remove lock to reply.
...
php to php objHi All,
Is there any tool to convert the .php files into its object files in
deploying the files to other's server like java classes are deployed?
Thanks in advance
--AR
John7481 <arjohn7481@hotmail.com> wrote or quoted:
> Is there any tool to convert the .php files into its object files in
> deploying the files to other's server like java classes are deployed?
To what end?
Do you want a PHP obfuscator? They tend not to be needed - since the code
remains on the server.
Do you want a PHP squeezer? Again - since PHP remains on the server
that is of reduced importance.
PHP obfuscators and squeezers are out there - but what exactly
are you looking for?
--
__________
|im |yler http://timtyler.org/ tim@tt1lock.org Remove lock to reply.
With total disregard for any kind of safety measures Tim Tyler
<tim@tt1lock.org> leapt forth and uttered:
> John7481 <arjohn7481@hotmail.com> wrote or quoted:
>
>> Is there any tool to convert the .php files into its object
>> files in deploying the files to other's server like java
>> classes are deployed?
>
> To what end?
>
> Do you want a PHP obfuscator? They tend not to be needed -
> since the code remains on the server.
>
> Do you want a PHP squeezer? Again - since PHP remains on the
> server that is of reduced importance.
>
> PHP obfuscators and squeezers are out there - but what exactly
> are you looking for?
I think he'...
Why is shared host php GID and UID the same in my PHP Script?I ran this:
$processUser = posix_getpwuid(posix_geteuid());
echo("<pre>"); print_r($processUser); echo("</pre>");
I got this result:
Array
(
[name] => aremssp
[passwd] => x
[uid] => 2244
[gid] => 2244
[gecos] =>
[dir] => /home/aremssp
[shell] => /usr/local/cpanel/bin/noshell
)
Why are the GID and UID the same?
SMHealthNick wrote:
> I ran this:
> $processUser = posix_getpwuid(posix_geteuid());
> echo("<pre>"); print_r($processUser); echo("</pre>");
...
PHP within PHP...I took over the support of a website that is set up something like
this inside one of the pages:
include_once("header.php");
<?php
//to get the content of the page they do this:
$content = mysql_query("select content etc...);
echo $content;
?>
include_once("footer.php");
I am having problems evaluating any php that is used in the mysql
content. Is there a way to get the mysql withing the mysql to run?
Thank you for your time,
Mandragon
On Sep 17, 12:56 pm, Mandrago...@gmail.com wrote:
> I took over the support of a website that is set up something like
> this inside one of the pages:
>
> include_once("header.php");
>
> <?php
> //to get the content of the page they do this:
> $content = mysql_query("select content etc...);
>
> echo $content;
> ?>
>
> include_once("footer.php");
>
> I am having problems evaluating any php that is used in the mysql
> content. Is there a way to get the mysql withing the mysql to run?
>
> Thank you for your time,
>
> Mandragon
Sorry, The question should read:
"Is there a way to get the php withing the echo $htmlcontent to run?"
Of course you are, $content is a resource. The MySQL Query resource.
try this:
$content = mysql_query('bla bla bla');
while ($row = mysql_fetch_assoc($content)) {
$result[] = $row;
}
$content = $result;
Now you can use $content ;).
In answer to your edit...
eval($co...
php outside php (?)Sounds weird, i know.
What i want/wonder is the following:
PHP can do the next:
<?php
if($foo == 'bar')
{
?>
Ow yeah, foo is bar!
<?php
};
?>
But how can i do the following:
<?php
$foo=
?>
this is what foo looks like.
<?php
};
?>
This way i could edit the content of $foo in DW's design-view.
I hope it's clear enough for you all to understand...
Greetings frizzle.
frizzle wrote:
> But how can i do the following:
>
> <?php
>
> $foo=
>
> ?>
> this is what foo looks like.
> <?php
>
> };
>
> ?>
>
> This way i could edit the content of $foo in DW's design-view.
> I hope it's clear enough for you all to understand...
<?php
ob_start();
?>
this is what foo looks like.
<?php
$foo=ob_get_clean();
?>
--
Justin Koivisto - justin@koivi.com
http://koivi.com
Wow, little late on the reply,
but i still wanted to thank you for your help.
This is exactly what i meant, and it works great! :D
Thanks again.
...
Passing parameter from non-PHP-program to PHP/cgiIn my (Java)program I read a POST-request from a web-client over a
socket and will pass this request to a PHP/cgi-module, to get PHP's
generated HTML-stream.
The request contains formular-parameter and the data from an uploaded
file.
I copy the parameter-names and the values and pass them to PHP. This
works fine, but I don't know how to tell PHP, it may read the data
from the uploaded file.
Who can help me ?
regards Siegfried
...
Passing parameter from a non-PHP-program to PHP/cgi- In my (Java)program I read a POST-request from a Web-client over a socket
and will pass this request to a PHP/cgi-Modul, to get PHP's generated
HTML-stream.
- The request contains formular-parameter and the data from an uploaded file.
- I copy the parameter-names and the values and pass them to PHP. This
works fine, but I don't know how to tell PHP, it may read the data from
the uploaded file.
Who can help me ?
regards Siegfried
...
Trouble passing JS parameter to PHP program /or/ executing the PHP
Taken from a couple very similar samples on the net, I'm having
trouble passing a parameter to a PHP file.
Here's all the JS code ... it creates an image object and modifies
it's src to make a 'call' to the PHP file:
var myobj = new Image();
myobj.src = 'http://www.mypage.com/my.php?url=' + 'anything_here';
The process seems to recognize that the file URL ends at the "?", and
system logs show that the GET of the PHP file was successful.
However, it doesn't seem to execute the PHP (internal debug logging
does not occur).
The PHP code it...
how to enable permissions in htaccsess for php file.php script problemsI am having problems with a ftp to http php scrip: Warning: ftp_get():
open_basedir restriction in effect. File(/ftp_login.html.600490715) is
not within the allowed path(s): (/home:/tmp:/usr) in
/home/jbsmedia/public_html/ftp.php on line 352. when i download files,
when i upload i get Upload failed! Can't create temp file?.
as far as i fuigured i set my ftp file folder cmod 777. then must have
to do somethin to the htaccess file. my host is running a unix appache
server.
i found it has something to do with internal server error 500
and mkdir command=
mkdir /var/tmp/xfers && chmod 1777 /var/tmp/xfers */
$phpftp_tmpdir="/var/tmp/xfers"
can anyone help
sorry type error http to ftp script
...
Passing parameter from a non-PHP-program to PHP/cgi #3- In my (Java)program I read a POST-request from a Web-client over a socket
and will pass this request to a PHP/cgi-Modul, to get PHP's generated
HTML-stream.
- The request contains formular-parameter and the data from an uploaded file.
- I copy the parameter-names and the values and pass them to PHP. This
works fine, but I don't know how to tell PHP, it may read the data from
the uploaded file.
Who can help me ?
regards Siegfried
...
Passing parameter from a non-PHP-program to PHP/cgi #2- In my (Java)program I read a POST-request from a Web-client over a socket
and will pass this request to a PHP/cgi-Modul, to get PHP's generated
HTML-stream.
- The request contains formular-parameter and the data from an uploaded file.
- I copy the parameter-names and the values and pass them to PHP. This
works fine, but I don't know how to tell PHP, it may read the data from
the uploaded file.
Who can help me ?
regards Siegfried
...
How to get the filename of a called PHP scriptI'd like to get the filename of a called PHP script.
E.g. if you call
http://www.test.com/subdir/start.php
I'd like to get within the PHP script 'start.php' the name 'start.php'.
I've several PHP scripts and of course I could add at the beginning of each
PHP script the name of the PHP script itself. But if there's a possibility
to read its name from the filename I'd prefer this method.
Stefan
Stefan Mueller wrote:
> I'd like to get the filename of a called PHP script.
> E.g. if you call
> http://www.test.com/subdir/start.php
> I'd like to get within the PHP script 'start.php' the name 'start.php'.
>
> I've several PHP scripts and of course I could add at the beginning of each
> PHP script the name of the PHP script itself. But if there's a possibility
> to read its name from the filename I'd prefer this method.
>
> Stefan
One of these has what you want:
<http://www.php.net/reserved.variables>
> One of these has what you want:
> <http://www.php.net/reserved.variables>
Great, many thanks
Stefan
...
How to make PHP call a remote ScriptI have a remote script on a local network and I need to make Web App in
PHP, call this remote script on a different machine. How do I do this?
Many Thanks.
johnny schrieb:
> I have a remote script on a local network and I need to make Web App in
> PHP, call this remote script on a different machine. How do I do this?
This way, for example:
$viart_xml = fsockopen("www.server.com", 80, $errno, $errstr, 12);
fputs($viart_xml, "GET /aScript.xml HTTP/1.0\r\n");
fputs($viart_xml, "Host: www. server.com\r\n");
fputs($viart_xml, "Referer: http://www. server.com\r\n");
fputs($viart_xml, "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0;
Windows NT 5.1)\r\n\r\n");
This may work too, but not using PHP 4.4.2
[http://bugs.php.net/bug.php?id=36017]:
$viart_xml = fopen("http://www.viart.com/viart_shop.xml", "r");
seaside wrote:
>
> johnny schrieb:
>
>> I have a remote script on a local network and I need to make Web App in
>> PHP, call this remote script on a different machine. How do I do this?
>
> This way, for example:
>
> $viart_xml = fsockopen("www.server.com", 80, $errno, $errstr, 12);
>
> fputs($viart_xml, "GET /aScript.xml HTTP/1.0\r\n");
> fputs($viart_xml, "Host: www. server.com\r\n");
> fputs($viart_xml, "Referer: http://www. server.com\r\n");
> fputs($viart_xml, &qu...
Embedding secure scripting language in PHP (req PHP internals expert)
I need to expose some scripting functionality to novice users in a project
of mine. What i wonderd was if anyone knew a way of executing secure PHP
from within a PHP script or an alternative embedded scripting method? Some
interaction between the PHP script host and the secure embedded script are
needed.
I'm currently i'm playing with ASP.NET(C#) and embeded
jscript(spidermonkey) via managed C++ library but it's quite alot of work,
complex.
I already know about runkit but last time i checked it was pretty broken
and lacked execution time limits; I also emailed the author but got no
reply. Perhaps just fixing runkit myself would be a simpler option? Is
this a viable option, can runkit be fixed up to properly secure a PHP
context? Spawning a seperate process for every request is pretty much out
of the question as it's too expensive for what i have in mind, this is for
a windows host so.
I need to allow looping, branching and basic PHP features but no access to
OS resources and absolutely no file system access. I'd also need a way to
impose memory and CPU time restrictions.
Thanks for any help.
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
"Nemon" <nemon@home.fake.com> wrote in message
news:op.tgle7lu5no4rwm@nautilus...
<snip />
> I need to allow looping, branching and basic PHP features but no access to
> OS resources and absolutely no file system access. I'd...
want to get content of one php file in another php filei have one php file having content
Contents of ex1.php file
<body>
<?php
$content = "c://webserver/www/abc.php";
$handle = fopen($content, "r");
echo fread($handle,filesize($content));
?>
</body>
this is reading abc.php file in which i m simply using an echo
statement. When i execute ex1.php file i cant see the php statement of
abc.php file
content of abc.php file is
<?php echo "hello";?>
sarika wrote:
> i have one php file having content
>
> Contents of ex1.php file
> <body>
> <?php
> $content = "c://webserver/www/abc.php";
> $handle = fopen($content, "r");
> echo fread($handle,filesize($content));
> ?>
> </body>
> this is reading abc.php file in which i m simply using an echo
> statement. When i execute ex1.php file i cant see the php statement of
> abc.php file
>
> content of abc.php file is
> <?php echo "hello";?>
That's interesting, I've found out that it's the browser that's hiding <?php
?> tags within .phpx pages. Probably to avoid short tags scripts (on a
server that doesn't allow them) from getting leaked by visitors who don't
know about this browser trick, until the dev' realizes his error.
Not a good thing, IMO; dev's should take care, themselves, and it's still
not secure since the hidden string is still in the rendered source. And now
we don't know how ...
run php on a script, from a scriptHi
I would like to know if the following is possible and how to do it:
1)
I have a "template" .php file on my server, say template.php.
It contains some PHP instructions and some HTML
2)
I also have a script, script.php
3)
When script.php runs, I want it to run php on template.php, and write
the resulting html output to a file.
I need to say something like:
<?php
runphp ( 'template.php', 'htmloutput.html' );
?>
and obtain a file, htmloutput.html, with the result of php having run
template.php (hope I'm being clear).
The problem is, of course, that the runphp function doesn't exist so
what is the way to do it?
Thanks
Fred
"Fred Paris" <nono@nono.invalid> wrote in message
news:mr5ku1dpuaiukdi9j85t8b002v5lepn8qm@4ax.com...
> Hi
>
> I would like to know if the following is possible and how to do it:
>
> 1)
> I have a "template" .php file on my server, say template.php.
> It contains some PHP instructions and some HTML
>
> 2)
> I also have a script, script.php
>
> 3)
> When script.php runs, I want it to run php on template.php, and write
> the resulting html output to a file.
>
> I need to say something like:
>
> <?php
>
> runphp ( 'template.php', 'htmloutput.html' );
>
> ?>
>
> and obtain a file, htmloutput.html, with the result of php having run
> template.php (hope I'm being clear).
>
> The...
calling a php script using img src ="random.php"Hey all,
I have a small php script that calls a random image at the following
page.
http://www.2006ymcanationals.com/random.php
IT WORKS IF I go directly to the above link.
I am trying to call that in another page so that i get a random image
the page is http://2006ymcanationals.com/index.php using <img
src="random.php">
It is not working. I have tried using the full path to the
"random.php". I have also tried naming the main page index.html and
index.php. neither work.
what am i missing? Searching these groups it looks like this should
work.
Thanks in advance.
Brad
<bhennon@gmail.com> wrote in message
news:1111008806.788804.63370@l41g2000cwc.googlegroups.com...
> Hey all,
>
> I have a small php script that calls a random image at the following
> page.
> http://www.2006ymcanationals.com/random.php
>
> IT WORKS IF I go directly to the above link.
>
> I am trying to call that in another page so that i get a random image
> the page is http://2006ymcanationals.com/index.php using <img
> src="random.php">
>
> It is not working. I have tried using the full path to the
> "random.php". I have also tried naming the main page index.html and
> index.php. neither work.
>
> what am i missing? Searching these groups it looks like this should
> work.
>
> Thanks in advance.
>
> Brad
It's hard without looking at the code.
The images seem to be different n...