私はプロジェクトに取り組んでいます。私はPastebinでホストされるHTMLスクリプトを含めたいと思います。以下のようなリモートHTMLファイルを含む
何か:
include 'http://pastebin.com/raw/testiungshdhd';
は私が
fgets(fopen('http://pastebin.com/raw/asdasddaqwe', 'r'));
しかし、負のを試してみました。
私はプロジェクトに取り組んでいます。私はPastebinでホストされるHTMLスクリプトを含めたいと思います。以下のようなリモートHTMLファイルを含む
何か:
include 'http://pastebin.com/raw/testiungshdhd';
は私が
fgets(fopen('http://pastebin.com/raw/asdasddaqwe', 'r'));
しかし、負のを試してみました。
てみカール:
http://php.net/manual/en/book.curl.php
Basicの例:
$ch = curl_init("http://www.example.com/");
$fp = fopen("example_homepage.txt", "w");
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);
fclose($fp);
他にも 'include '';'と同じような単純な方法はありません。 –
そのように含まれています。 curl_include()のような関数を文字列paramで書くことができ、それはincludeと同じように動作します。 – RaV
あなたがfile_get_contents
で行うことができます。
$data = file_get_contents('http://pastebin.com/raw/JyEcHhy2');
まず、あなたはとしてphp.iniファイルを設定し有効にする必要があります: - :
方法1:
<?php
include("http://pastebin.com/raw/asdasddaqwe");
?>
方法2
allow_url_include=On
が、それを達成することが可能な方法がいくつかあります:
これは、含まれようとしているリモートソースファイル。
http://stackoverflow.com/questions/1158348/including-a-remote-file-in-php – Suyog