Difference between revisions of "File get contents"

From TORI
Jump to navigation Jump to search
(Created page with "file_get_contents is php command used to get contents of a file or that of a side specified as argument. ==Example== Here is sample of the php code that downloads the...")
 
 
Line 2: Line 2:
   
 
==Example==
 
==Example==
Here is sample of the php code that downloads the content of the last Worldmeters report about coronavirus:
+
Here is sample of [[php]] code that downloads the content of the last Worldmeters report about coronavirus:
 
<poem><nowiki>
 
<poem><nowiki>
 
<?php
 
<?php
Line 18: Line 18:
 
?>
 
?>
 
</nowiki></poem>
 
</nowiki></poem>
  +
 
==References==
 
==References==
 
<references/>
 
<references/>

Latest revision as of 12:01, 6 June 2020

file_get_contents is php command used to get contents of a file or that of a side specified as argument.

Example

Here is sample of php code that downloads the content of the last Worldmeters report about coronavirus:


<?php
#date_default_timezone_set("Japan");
date_default_timezone_set("GMT");
for($n=0;$n<1400;$n++)
{
#$d=date("Y.m.d:H:i:s")."gmt.txt";
sleep(6*3600);
$d=date("m.d.H.i.s")."gmt.txt";
echo $d,"\n";
$f=file_get_contents("https://www.worldometers.info/coronavirus/");
file_put_contents($d,$f);
}
?>

References


Keywords

Coronavirus, file_get_contents, file_put_contents, Php, Worldometers