<?php
$files = file_get_contents('test.php');
$fileName = "kabu".rand(1000000,9999999);
$files = mb_convert_encoding($files, "UTF-8", "AUTO");
$fileName = $fileName. ".php";
$handle = fopen($fileName, 'w');
fwrite($handle, $files);
fclose($handle);
print $fileName. "を生成しました。<br>\n";
?>
kabu6512964.phpを生成しました。
<?php
require_once('query/phpquery/phpQuery/phpQuery.php');
$code = 3928;
$url = 'https://hogehoge.jp?code='.$code;
$html = file_get_contents($url);
$doc = phpQuery::newDocument($html);
$message = $doc[".hogehoge"]->text();
$price = $doc[".hoge"]->text();
?>
<!DOCTYPE html>
<html lang="ja">
<head>
<title><?php echo $code."|".$message;?></title>
</head>
<body>
<b><?php echo "【".$code."】".$message;?></b>
<p>現在の株価:<?php echo $price;?></p>
</body>
</html>