f



Read *parsed* PHP file into a variable?

Hello,

I have this strange including problem: 

I want to read a piece of HTML, residing in some file, into a
variable, not echo it out. So far so easy - but now the HTML contains
a line of PHP. And I wish not to get the PHP code into my variable but
the parsed result, just like if the variable was a client ;-). I wish
to keep the nice ?> ...<? HTML area (with highlighting in my editor),
and therefore include etc. don't help because they would echo it out.
heredoc also doesnt help (if this may come up to your mind).

Is there anything I can do...?!! The problem sounds so simple... the
more for such a great tool like PHP ... but... ?!! 

Thanx a lot, 
Daniel

PS Please post also if you know for sure that there is NO solution to
my problem

0
8/24/2005 6:16:15 PM
comp.lang.php 32646 articles. 0 followers. Post Follow

6 Replies
696 Views

Similar Articles

[PageSpeed] 5

"Daniel Loose" wrote:

> Hello,
> 
> I have this strange including problem:
> 
> I want to read a piece of HTML, residing in some file, into a
> variable, not echo it out. So far so easy - but now the HTML contains
> a line of PHP. And I wish not to get the PHP code into my variable but
> the parsed result, just like if the variable was a client ;-). I wish
> to keep the nice ?> ...<? HTML area (with highlighting in my editor),
> and therefore include etc. don't help because they would echo it out.
> heredoc also doesnt help (if this may come up to your mind).
> 
> Is there anything I can do...?!! The problem sounds so simple... the
> more for such a great tool like PHP ... but... ?!!

Easy: $html = file_get_contents('http://www.example.com/foo.bar');

Take a look here: <http://php.net/file_get_contents>

-- 
phil [dot] ronan @ virgin [dot] net
http://vzone.virgin.net/phil.ronan/


0
invalid171 (7008)
8/24/2005 7:07:31 PM
"Daniel Loose" <noreply@web.de> kirjoitti 
viestiss�:430cb793.9399600@news.cs.tu-berlin.de...
> Hello,
>
> I have this strange including problem:
>
> I want to read a piece of HTML, residing in some file, into a
> variable, not echo it out. So far so easy - but now the HTML contains
> a line of PHP. And I wish not to get the PHP code into my variable but
> the parsed result, just like if the variable was a client ;-). I wish
> to keep the nice ?> ...<? HTML area (with highlighting in my editor),
> and therefore include etc. don't help because they would echo it out.
> heredoc also doesnt help (if this may come up to your mind).
>
> Is there anything I can do...?!! The problem sounds so simple... the
> more for such a great tool like PHP ... but... ?!!


Sounds like you could use buffering.
<?php

ob_start(); // Start output buffering.
// Instead of outputting anything, the output is now stored in a buffer.
include('yourfile.php');
// There, now the file has been included and php parsed.
// It isn't output, it goes into the buffer.
$yourfile = ob_get_clean();
// Now we read everything that has been buffered... And stops buffering.

?>

Result: the file you included has been parsed by the php engine and stored 
inside $yourfil, and nothing was output. Sounds like goal achieved.

-- 
SETI @ Home - Donate your cpu's idle time to science.
Further reading at <http://setiweb.ssl.berkeley.edu/>
Kimmo Laine <eternal.erectionN0@5P4Mgmail.com> 


0
8/24/2005 7:20:46 PM
Just discovered http://de.php.net/eval and on that url especially the
user contributed function eval_html3(). But can't get it to work.

I made a simple test page:
http://mueller.zems.tu-berlin.de/~loose/test/test.php
Perhaps you feel like helping to fix the function. (Or to tell me what
I have misunderstood.) I just renamed eval_html3 to eval_html and
replaced <?php by <?. It's now supposed to work but it doesnt. Here
the test files:

test.php:
------------
$s = eval_html(file_get_contents('.js.php', 0));
$t = eval_html(file_get_contents('.css.php', 0));

function eval_html($string) {
   $string = '<? ?>'.$string.'<? ?>';
   $string = str_replace( '?>', '', str_replace( array( '<?', '<?' ),
'', preg_replace_callback( "/\?>(.*?)(<\?|<\?)/", "my_eval", $string )
) );
   return eval($string);
}		
function my_eval($arr) {
   return ('echo stripslashes("'.addslashes($arr[0]).'");');
}

..js.php and .css.php: 
------------------------------
contain plain js/ css plus one line
<? $a = 6+7; echo ".testClass { font-size: ".$a."px; }\n\n"; ?>
or resp. 
<? $a = 4+5; echo 'testVar = '.$a;; ?>
No errors when called directly.

test.php itself does nothing (blank screen), I only want to get away
the errors. You may also download this small test if you want to
figure it out on your own system (See Link)

Thanx a lot! , Daniel

PS Thx to the other poster, will check your idea out soon as possible.
0
8/24/2005 7:32:36 PM
Daniel Loose wrote:
> Just discovered http://de.php.net/eval and on that url especially the
> user contributed function eval_html3(). But can't get it to work.
>

Better have a look at Kimmo's suggestion, because that's the way to go...


JW



0
jw137 (829)
8/24/2005 7:57:33 PM
>Sounds like you could use buffering.
><?php
>
>ob_start(); // Start output buffering.
>// Instead of outputting anything, the output is now stored in a buffer.
>include('yourfile.php');
>// There, now the file has been included and php parsed.
>// It isn't output, it goes into the buffer.
>$yourfile = ob_get_clean();
>// Now we read everything that has been buffered... And stops buffering.
>

Pretty cool, thanx so much! Never heard of output buffering before.
Yeah...

Guess no need to fight with my other Reply anymore (concerning
eval_html()).

Enjoy, D.
0
8/24/2005 8:14:29 PM
Daniel Loose wrote:
> Hello,
>
> I have this strange including problem:
>
> I want to read a piece of HTML, residing in some file, into a
> variable, not echo it out. So far so easy - but now the HTML contains
> a line of PHP. And I wish not to get the PHP code into my variable but
> the parsed result, just like if the variable was a client ;-). I wish
> to keep the nice ?> ...<? HTML area (with highlighting in my editor),
> and therefore include etc. don't help because they would echo it out.
> heredoc also doesnt help (if this may come up to your mind).
   <snip>

   Sounds like you're going to use/eval users' input?--if so, it's a
*serious* security issue. Use output buffering with runkit
<http://in.php.net/runkit>

--
  <?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com    Blog: http://rajeshanbiah.blogspot.com

0
ng4rrjanbiah (1570)
8/25/2005 11:19:26 AM
Reply:

Similar Artilces:

PHP does not parse .PHP files
I have this problem with PHP that someone might be able to help. With CLI, I am able to execute my .php files. For example, if I type "php phpinfo.php" , this works fine on my system. If I put the phpinfo.php file is in /var/www/html and I try to access it through the browser, I get the content of the file and not the execution of the file. Instead of display the info of PHP, I got the text of the file as: <?php phpinfo(); ?> Why? Thanks Phong Ho wrote: >I have this problem with PHP that someone might be able to help. > >With CLI, I am able to execute my ....

Is a PHP variable supposed to be seen in a .js file included into a .php file
Is a PHP variable supposed to be seen in a .js file included into a .php file? I have a client side javascript code stored in a .js file which is included into a PHP file using <script src="filename.js></script> This code initialises a Javascript variable var u="string"; The string is supposed to be the value of $HTTP_HOST So, when initialise this variable like var u=<? echo $HTTP_HOST;?>; I sterted getting a javascript message Syntax Error Am I doing something wrong, or PHP variables are not seen in included js files? aa wrote: > Is a PHP variable supposed to be seen in a .js file included into a .php > file? > > I have a client side javascript code stored in a .js file which is included > into a PHP file using > <script src="filename.js></script> > > This code initialises a Javascript variable > var u="string"; > > The string is supposed to be the value of $HTTP_HOST > > So, when initialise this variable like > > var u=<? echo $HTTP_HOST;?>; > > I sterted getting a javascript message Syntax Error > > Am I doing something wrong, or PHP variables are not seen in included js > files? js files are not parsed for PHP code unless you specifically tell the webserver to do so. Therefore, "var u=<? echo $HTTP_HOST;?>;" in the .js will error since the browser doesn't know what to do. -- Justin Koivisto - spam@koiv...

Parsing a php include (which also contains php code)
Hello, I am using the <?php include() ?> statement on my website for organizational purposes. However, one of my includes contains some PHP code. Is there any way for the server to actually parse the include? I've tried this before, and it did not parse the include. Rather, it included the file as just plain ASCII. ======================= /*EXAMPLE 1*/ /*index.php*/ .... <?php include('global/includes/footer.inc') ?> .... /*footer.inc*/ .... <p>&copy 1993-<?php echo date("Y") ?> Kingswood School. All rights reserved.</p> .... /*EXAMPLE 2*/ /*index.php*/ .... <?php include('global/includes/lastmod.php') ?> .... /*lastmod.php*/ .... <?php echo "This file was last modified: "; echo strftime("%A %B %d %Y"); include('whateverfilename.inc'); ?> ============================= I would like to be able to parse the include if it has php code, and in some cases, create nesting includes (an include within an include). Is this even possible? Any ideas? Any help is certainly appreciated. Thanks! Steven Borrelli Web Developer Kingswood School Steven Borrelli wrote: > Hello, > > I am using the <?php include() ?> statement on my website for > organizational purposes. However, one of my includes contains some > PHP code. Is there any way for the server to actually parse the > include? I've tried this before, and it did not parse the in...

want to get content of one php file in another php file
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";?> 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 ...

Open .php file with PHP Designer 2007 by clicking the file in XP
In windows XP, I want to be able to click on a .php file and have it opened in PHP Designer 2007, Or right-click on it and have an "edit" menu option presented to me. I know how to tweak the registry to do this in general, but what would the command line look like in this specific case ? PHP Designer does not do this automatically. It is as if the program does not allow commandline options. It only opens with the last file used or a menu of recently opened files. ...

php variable continaing php code
Hi There, I am absolutly stumped by this, any help appreciated. Due to factors outside of my control I have a php variable containing php code and I dont know how to evaluate it. I know its stupid, but php calls a database function (which I dont have access to) which reads in a template html file and returns it as a string. Now If I want the template to be a bit more dynamic and contain php I have a problem. After calling the database function I end up with: (examaple only) $var = "<?echo "hello world";?>"; //$var is now equal to the template file - usually html but attempting to add php now if I echo that out I get: <?echo "hello world";?> but I want: hello world Can I call another instance of the php interpreter on php variable $var? Would the eval() function work? Any way to acheive what I am after? Thanks jds5@xtra.co.nz wrote: > Hi There, > I am absolutly stumped by this, any help appreciated. > Due to factors outside of my control I have a php variable containing > php code and I dont know how to evaluate it. > > I know its stupid, but php calls a database function (which I dont > have access to) which reads in a template html file and returns it as > a string. Now If I want the template to be a bit more dynamic and > contain php I have a problem. > > After calling the database function I end up with: (examaple only) > $var = "<?echo "hello world";?>"; >...

Modify a php file(model) with php
I have an invoice model on my server! and i want to replace some field(like adresse, phone, price, VAT, ....) do you know a tools or class that allows those kind of manipulations Thanks you Yoni Yoni Alhadeff a �crit : > I have an invoice model on my server! and i want to replace some field(like > adresse, phone, price, VAT, ....) > > do you know a tools or class that allows those kind of manipulations > > Thanks you > > Yoni > > Couldn't you replace field with var and have them set when including your template (it become one in fact) ? I didn'...

When does the php interpreter loads the php file?
Hi All, I'm wondering three facts about php, apache and apache module. 1.How can i differentiate the php intepreter if it's running as a apache module or as cgi? 2.When does the php interpretor loads the php file to main memory? 3.and till when it keeps the php file on memory? - in my experience only after installing Zend it caches the php file. Thak you *** Kim Gijung wrote/escribi� (20 Oct 2004 00:03:35 -0700): > 1.How can i differentiate the php intepreter if it's running as a > apache module or as cgi? If I recall correctly phpinfo() calls it "Server API&qu...

php assembly of multiple php files
I am trying to combine multiple php pages into 1. Basically I have created a shell page and then a seperate php file for each form to be included within the shell. The problem I am having is that when a user submits one of the forms the main shell and the other php files POST values are all returned as NULL and I only get the values pertaining to the form that was submitted?. If all the files were combined into one very long php file, I would get all the POSTs returned how can I do the same but with multiple files? When you submit an include, do the POST values not get passed back to the Main calling page? Thank you, QB Question Boy wrote: > I am trying to combine multiple php pages into 1. > > Basically I have created a shell page and then a seperate php file for > each form to be included within the shell. > > The problem I am having is that when a user submits one of the forms > the main shell and the other php files POST values are all returned as > NULL and I only get the values pertaining to the form that was > submitted?. If all the files were combined into one very long php > file, I would get all the POSTs returned how can I do the same but > with multiple files? > > When you submit an include, do the POST values not get passed back to > the Main calling page? > > Thank you, > > QB This has nothing to do with PHP - it's how HTML works. The browser will only send the data for the form being subm...

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...

Parsing a PHP file
In my PHP script, I'd like to examine another PHP file to get information on the classes it will define before I include it (alternatively, getting a list of the classes after I've included it would be fine too). I realize that I could do some regular expressions and hope for the best, but my ideal solution has no chance of misfiring (e.g. capturing something in a comment or string, or missing something because it's on multiple lines). My idea at the moment is to pick apart something like Doxygen or GeSHi and figure out some simple file parsing, but I think that's pretty involved for my aims here. Does anyone have a suggestion? Regards, Ryan Govostes Hm, I just noticed the get_declared_classes() function. I could probably get a before-and-after list and compare them to figure out which classes were added. Any other ideas are still welcome. On 30 Apr 2007 14:09:42 -0700, in comp.lang.php Ryan Govostes <rgovostes@gmail.com> <1177967382.067595.130100@h2g2000hsg.googlegroups.com> wrote: >| In my PHP script, I'd like to examine another PHP file to get >| information on the classes it will define before I include it >| (alternatively, getting a list of the classes after I've included it >| would be fine too). I realize that I could do some regular expressions >| and hope for the best, but my ideal solution has no chance of >| misfiring (e.g. capturing something in a comment or string, or missing >| something because i...

SSI Including PHP File Within PHP File Causes Seg Fault and Crash
Can somebody concur or verify the following? I'm having this problem on all of my installations. I've got Apache 2.0.40 and PHP 4.2.2 installed and configured from RedHat RPMs. Nothing out of the ordinary. In the httpd.conf file, PHP files are called with the following: <Files *.php> SetOutputFilter PHP;INCLUDES SetInputFilter PHP LimitRequestBody 524288 </Files> I create two files as follows: /test1.php <!--#include virtaul="/test2.php" --> and /test2.php Testing 1 2 3 By going to http://host/test1.php, it may or may not display the fi...

including a PHP file displays the file's content to the user agent (PHP 5.1)
Hi all I'm having a strange problem when upgrading the content management system eZ publish from PHP 4.4 to PHP 5.1. Some cache files related to i18n are included with the "include" function, but they are being displayed to the user agent instead of being parsed by PHP. With PHP 4.4 there was no problem. You can download a test script from: http://blog.kristofcoomans.be/wp-content/uploads/test.tar Thanks for your help Cheers -- Kristof Cyberwolf wrote: > Hi all > > I'm having a strange problem when upgrading the content management > system eZ publish from PHP 4.4 to PHP 5.1. Some cache files related to > i18n are included with the "include" function, but they are being > displayed to the user agent instead of being parsed by PHP. With PHP > 4.4 there was no problem. > > You can download a test script from: > http://blog.kristofcoomans.be/wp-content/uploads/test.tar > > Thanks for your help > > Cheers > > -- > > Kristof Do any other php pages parse properly? If not, then it will most likely be a problem with your install and/or configuration. If you can parse some php pages, it might be worth checking your PHP 5 configuration, and then Apache's configuration if nothing jumps out at you in there. Is there any particular reason you chose to go with PHP 5? I have heard of lots of people having problems with it, which is why I stay away from it. Well, until I understand it a bit better...

PHP/IIS: File Read/Write OK, File Unlink Denied
Hi there, I'd greatly appreciate any insights into the following problem: I've got PHP running fine on IIS (OS: Server 2003, SP1; IIS: 6.0; PHP: 4.3.11). In PHP, the user uploads a file, which is then processed and the contents are inserted into a new file, created in PHP, onto the server. This bit works fine, the new file created by PHP is correctly stored. Later, once the user confirms the upload and PHP inserts the contents of the file into the DB, the code tries to remove the file created in PHP moments earlier, via the unlink() function. What I see on screen is the following: Permission denied I have made sure that the permissions for the Internet account that created (and is trying to delete) the file have full permissions over this particular folder and the files within it. But the user must have permission anyway, because they are able to create this file in the first place. I've looked at the permissions for the file in PHP, which read: 0666. So everthing *appears* ok to me; I can't see where the permission issue is coming from. Anyone got any ideas? TIA, Lorenzo. <lorenzogordon@hotmail.com> wrote in message news:1143022232.809686.208670@i39g2000cwa.googlegroups.com... > Hi there, > > I'd greatly appreciate any insights into the following problem: > > I've got PHP running fine on IIS (OS: Server 2003, SP1; IIS: 6.0; PHP: > 4.3.11). > > In PHP, the user uploads a file, which is then processed and the...

how to read out the content of a file named domain.com/file.php?X=ABC
I need some help reading out files. Here's my problem: I have a website where several pages are accessed through PHP-variables, such as http://domain.com/file.php?content=abc http://domain.com/file.php?content=xyz "abc" and "xyz" also being the .txt-files that contain the content which is inserted into file.php through readfile(). So far so good. Now I'm working on a PHP-powered search script, which is supposed to read out the files and extract keywords. Therefore it has to open each file and get the contents into an array using file(). foreach ($file_array as $file_name) { $file_contents = @file($file_name); if ($file_contents) { ... However, file() won't react to file.php?content=abc, it will only read out file.php. What do I have to do to get $file_contents of "file.php?content=abc"? Any help on this is highly appreciated! Martin According to the manual here. http://www.php.net/manual/en/function.file.php http://www.php.net/manual/en/function.file.php http://www.php.net/manual/en/ref.filesystem.php#ini.allow-url-fopen What you're doing with "file.php?content=abc" is trying to retrieve a file by specifying its URL. You may check the option 'allow_url_fopen' in php.ini to see if it's enabled or not. just a guess: using file() reads the file through the servers file system, which prevents parsing and therefore delivers the source code of file.php you need to call file.php w...

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...

Dynamically saving HTML containing PHP variables through PHP
I have an HTML page with references to PHP variables. This HTML is included from another PHP page. How can I save the HTML page dynamically i.e. when all the PHP variables are written into the HTML page. Thanx in Advance Mitesh wrote: > I have an HTML page with references to PHP variables. This HTML is > included from another PHP page. How can I save the HTML page > dynamically i.e. when all the PHP variables are written into the HTML > page. > > Thanx in Advance Hi, Probably the easiest way: When creating the file that contains the values of PHP: 1) start outputbuffering above your page: ob_start() 2) Just output all you want, using your PHP variables to produce the output 3) At the end of the script, get the content of the buffer, and write that to the file you want to include elsewhere. If you have to do this for many pages (eg: all is dynamic), and have to automate the process: have a look at CURL. Curl can call another PHP script with POST or GET parameters given by you (eg the filename, other vars that are used to produce the output, etc) Hope that helps Regards, Erwin Moller "Mitesh" <oopsbabies@hotmail.com> kirjoitti viestiss�:1170926634.468367.313320@a34g2000cwb.googlegroups.com... >I have an HTML page with references to PHP variables. This HTML is > included from another PHP page. How can I save the HTML page > dynamically i.e. when all the PHP variables are written into the HTML > page. Do You mean th...

PHP read from file on server
Hello, I'am new PHP student and ( programmer ? ). I want to sell my software online but how can I create to PHP read from file on server with cd-keys on my server and send them to user e-mail. And delete sent cd-key ( first line ) after sent delete? Regards, Vedran ...

read file txt by php
sorry for my english, I would to read a txt file and to extrapolate only some data for to publish on the html page how first step i try to read and publish the file in this mode: <? $var=fopen("test.txt","r"); //Apro il file di testo $leggi=fread($var,filesize("test.txt")); $sss=nl2br($leggi); fclose($var); echo $sss; ?> this is the structure of the my file: INFO 2008/03/04 09:37:55.561 ; source=local; msg="xxxxxxxxxxxxx"; alerttext="kkkkkkkkkkkk"; date="Mar 04 09:37:55 2008"; END I would want to only extrapolate following strings: msg, alerttext, date PS the cycle of the text rows always begins with INFO and ends with END thanks!!! lucabonanni@googlemail.com wrote: > > > INFO 2008/03/04 09:37:55.561 ; > source=local; > msg="xxxxxxxxxxxxx"; > alerttext="kkkkkkkkkkkk"; > date="Mar 04 09:37:55 2008"; > END > > > I would want to only extrapolate following strings: > msg, alerttext, date > > PS > the cycle of the text rows always begins with INFO and ends with END > > > thanks!!! > Regular expressions are made for this. If the block ALWAYS has each of these lines in the same order, an expression like this would work: $count = preg_match_all('/INFO.*\nsource=.*;\nmsg="(.*)";\nalerttext="(.*)";\ndate="(.*)";\nEND/', $leggi, $parsed, PREG_SET_ORDER); This parses out ...

Reading and writing files in PHP
Hello, I have a question about how PHP handles multiple file reads/ writes. I made a page containing a self-submitting form where the user can type his name, topic and a text. When he submits the form, PHP reads the .php file in a variable. It then processes it: adds the user comments to the var and writes the modified file back to disk. Next time the user opens the page (s)he sees te comments (s)he and others added. So what I have is a very simple 'Blog' without using a database. The ..php file is modifying itself every time a user submits something. Questions > What happens when ...

cron jobs in PHP admin to run a PHP file
I want to run a php script every day. The page goes to a directory and parses a file and adds data to the database. Where it says "command" in cron jobs I don't know what it is looking for? Can I put the name of my php file? This is what I have: Minute Hour Day Month Weekday Command 1 8 1-7 1-31 * myPage.php The reason I am asking is I don't have a clue what PHPadmin wants in the command box. All I want to do is run the php script. Thanks, janis JRough wrote: >I want to run a php script every day. The page goes to a directory > and > parses a file and adds data to the database. Where it says "command" > in cron jobs I don't know what it is looking for? Can I put the name > of my php file? > > This is what I have: > > Minute Hour Day Month Weekday Command > 1 8 1-7 1-31 > * myPage.php > > The reason I am asking is I don't have a clue what PHPadmin wants in > the command box. All I want to do is run the php script. > > Thanks, > janis usually you would put the path to the php interpreter followed by any required options followed by the script file name On May 27, 12:17 pm, JRough <jlro...@yahoo.com> wrote: > I want to run a php script every day. The page goes to a directory > and > parses a file and add...

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. ...

Failed opening required 'PEAR.php' (include_path='F:\www\include') in F:\Program Files\PHP\PEAR\Text\CAPTCHA.php on line 22
Hi, Guys=EF=BC=8Cwhen I run my site ,I got some errors: Warning: require_once(PEAR.php) [function.require-once]: failed to open stream: No such file or directory in F:\Program Files\PHP\PEAR \Text\CAPTCHA.php on line 22 Fatal error: require_once() [function.require]: Failed opening required 'PEAR.php' (include_path=3D'F:\www\include') in F:\Program Files \PHP\PEAR\Text\CAPTCHA.php on line 22 It appears that it cann't find the pear.php ,but i checked my dir,and this file was there,and also I have my php.ini file checked,the include_path=3Dinclude_path=3D".;F:\Program Files\PHP\pear;F:\www \include" ,it looks all right,was there anything I have missed in the config file?Or something wrong ? Wish somebody can help me out. Thanks, Mikay >Warning: require_once(PEAR.php) [function.require-once]: failed to >open stream: No such file or directory in F:\Program Files\PHP\PEAR >\Text\CAPTCHA.php on line 22 >Fatal error: require_once() [function.require]: Failed opening >required 'PEAR.php' (include_path='F:\www\include') in F:\Program Files >\PHP\PEAR\Text\CAPTCHA.php on line 22 So where is the pear.php file? >It appears that it cann't find the pear.php ,but i checked my dir,and >this file was there,and also I have my php.ini file checked,the >include_path=include_path=".;F:\Program Files\PHP\pear;F:\www >\include" ,it looks all right,was there anything I have missed in the >config...

PHP Read Text File
Hey, read some tips/pointers on PHP.net but can't seem to solve this problem. I have a php page that reads the contents of a file and then displays the last XX lines of the file. Problem is this...whenever the file gets larger that ~5MB, the page just displays nothing, as though a timeout has occurred but I get no error. At 4.8MB (last confirmed size)...the function still works. Any ideas what code below is lacking?? <? $handle= fopen("/var/log/myfile", "r"); if ($handle) { while (!feof($handle)) { $arrLog[] = fgets($handle, 4096); } fclose($handle); } $int_number_of_lines = count($arrLog); if ($int_number_of_lines == 0) { echo '<p><strong>No lines read.</strong></p>'; } if ($int_number_of_lines < $int_lines) { $int_lines = $int_number_of_lines; } $int_firstline = $int_number_of_lines - $int_lines; echo 'Showing the last '.$int_lines.' lines out of '. $int_number_of_lines.'<BR />'; echo "<TABLE WIDTH=100% CLASS=\"mail\">\n"; for ($i=$int_firstline; $i<$int_number_of_lines; $i++) { echo "<TR><TD>".$arrLog[$i]."</TR></TD>\n"; } echo "</TABLE>\n"; ?> tlpell@gmail.com wrote: > Hey, read some tips/pointers on PHP.net but can't seem to solve this > problem. I have a php page that reads the contents of a file and then > displays the last XX lines o...

Web resources about - Read *parsed* PHP file into a variable? - comp.lang.php

Variable - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Westpac interest rate rise is one of many variable loan rate rises
WESTPAC is not alone in hitting its owner-occupier customers with a surprise interest rate rise, as dozens of other variable rate home loans ...

Airbnb upgrades variable pricing tool for hosts
Online home rental group Airbnb is rolling out an upgraded variable pricing tool that automatically raises or cuts room rates based on supply ...

Commonwealth Bank raises variable home loan rates
Home owners' mortgage costs are set to rise by hundreds of dollars a year, after the Commonwealth Bank became the latest bank to hike interest ...

CBA lifts variable home loan rates to offset costs associated with stricter capital requirements
The Commonwealth Bank to lift its home loan interest rates independently of the Reserve Bank to partially offset costs associated with stricter ...

Washington Square Signs Spielbergs, Choi Joins Variable and More
... films and an episode of the HBO comedy series "Girls," on which he plays the role of Ray Ploshansky. New York-based creative collective Variable ...

Mozilla moves Firefox to variable release schedule
... schedule process "carefully" and learning "a lot" from it in the past years, Mozilla has announced that Firefox is now moving to a variable ...

"You have to ignore many variables to think women are paid less than men. California is happy to try." ...
Writes Sarah Ketterer in The Wall Street Journal in "The ‘Wage Gap’ Myth That Won’t Die" (which you can get to without subscribing if you Google ...

Staley: 'A lot of different variables...been a hard year'
... 41° Navigation Home Giants A's Sharks Warriors Kings 49ers Raiders Quakes Insiders More Tickets Shop Watch Staley: 'A lot of different variables...been ...

When your environment variables are showing
There are embarrassing moments in life. There is the teacher calling you out as a child in class as you stare out the window wistfully imagining ...

Resources last updated: 3/24/2016 12:59:38 AM