前提・実現したいこと
file_get_contensがサーバーのセキュリティ上禁止だったのでcurlという関数で
「取り出したいデータのファイル」にある
発生している問題・エラーメッセージ
エラーメッセージ
該当のソースコード
php
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>取り出したいデータのファイル</title> </head> <style> </style> <body> <form method="get" action="../edit.php"> <button type="submit" name="edit" value="<?php echo (empty($_SERVER['HTTPS']) ? 'http://' : 'https://').$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];?>">編集</button> </form> <div class="menu"> <h1>メニュー</h1> <p>カレー</p> </div> </body> </html>
php
edit.php <!DOCTYPE html> <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset="utf-8" /> <title>別のファイルを表示したいファイル</title> </head> <style> </style> <body> <?php echo $_REQUEST['edit']; $url = $_REQUEST['edit']; $conn = curl_init(); // cURLセッションの初期化 curl_setopt($conn, CURLOPT_URL, $url); // 取得するURLを指定 curl_setopt($conn, CURLOPT_RETURNTRANSFER, true); // 実行結果を文字列で返す。 $res = curl_exec($conn); echo ($res); curl_close($conn); //セッションの終了 ?> </body> </html>

まだ回答がついていません
会員登録して回答してみよう