特定の ID を持つ要素だけを取得し、PHP で表示する方法が必要です。私はPHP初心者なので、これまでのところ非常に困難でした。これに似た他の質問はすべて少し複雑すぎたので、誰かが私に説明してくれるかどうか疑問に思っていました.
私が欲しいものをより具体的にするために、マインクラフトサーバーのスペル検索を行っています。私たちのウェブサイトはhttp://pvpzone.org/で、ウィキはhttp://pvpzone.wikispaces.com/にあります。各呪文には wiki にページがあり、「Vanish」のページは pvpzone.wikispaces.com/Vanish です。呪文検索のアイデアは、呪文を探すためのより簡単な方法です。呪文の名前を入力すると、結果が得られます。div 'wiki wikiPage' には、スペル データが含まれています。そのdivだけを取得して表示したい。悲しいことに、呪文を使ってどのような形式のデータベースにも接続できません。それは Wikispaces によってホストされており、許可されていません。
これが明確になったことを願っています。よろしければ詳細をお尋ねください。これが私がこれまでに持っているものです:
<?php
if(isset($_POST['submit']))
{
$spell=$_POST['spell'];
$pvpwiki="http://pvpzone.wikispaces.com/";
$site=$pvpwiki . $spell;
$submit=true;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Spell search</title>
</head>
<body>
<form name="spellsearch" id="spellsearchform" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input type="text" name="spell" value="<?php if(!isset($_POST['submit'])){echo("Vanish");}?>"></input>
<input type="submit" value="Search" name="submit"></input>
</form>
<?php
$doc = new DomDocument;
$doc->validateOnParse = true;
$doc->loadHtml(file_get_contents($site));
var_dump($doc->getElementById('wiki wikiPage'));
if($doc == false && $submit)
{
echo("<br />" . "That is not a spell!");
}
?>
</body>
</html>
私の問題は、解析エラーが発生することです (警告: DOMDocument::loadHTML() [domdocument.loadhtml]: ID target_editor already defined in Entity, line: 212 in /home/content/d/e/x/dext0459/ html/russellsayshi/phpspellsearch.php の 24 行目 NULL)、助けていただければ幸いです。