アプリ版:「スタンプのみでお礼する」機能のリリースについて

http://www.ezinfo.jp/contents/script/src/index.php
上記の様なPHPスクリプトを作りたいのですが、どうしたらよいですか?

PHP初心者なので、コピペで使用できるものがよいです。[出来ればですが。。]

A 回答 (1件)

こんなすかね。



<html>
<head></head>
<body>
<form action="./file.php">
URL:<input type="text" name="url"><br />
UA:<input type="text" name="ua"><br />
Ref:<input type="text" name="ref"><br />
<input type="submit">
</form>
<?php
$source = null;
if(isset($_GET['url'],$_GET['ua'],$_GET['ref'])){
$header = 'User-Agent: '.urlencode($_GET['ua'])."\r\n";
$header .= 'Referer: '.urlencode($_GET['ref'])."\r\n";

$options = array(
'http'=> array(
'method'=>'GET',
'header'=>$header
)
);
$streamContext = stream_context_create($options);
$url = $_GET['url'];

$source = file_get_contents($url,false,$streamContext);
}
?>
ソース:<?php echo htmlspecialchars($source,ENT_QUOTES); ?>
</body>
</html>
    • good
    • 0

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!