Note that there are some explanatory texts on larger screens.

plurals
  1. POGetting part of a webpage with PHP
    primarykey
    data
    text
    <p>I need a way to get only an element with a certain ID and display it with PHP. I am a PHP noob, so this has been very difficult so far. All the other questions similar to this were a bit too complicated, so I was wondering if someone could explain it to me.</p> <p>To be more specific on what I want, I am making a spell search for a minecraft server. Our website is <a href="http://pvpzone.org/" rel="nofollow">http://pvpzone.org/</a> and wiki is at <a href="http://pvpzone.wikispaces.com/" rel="nofollow">http://pvpzone.wikispaces.com/</a>. Each spell has a page on the wiki, like the one for "Vanish" is pvpzone.wikispaces.com/Vanish. The idea of the spell search would be an easier way to look for a spell, you type in the spell name and get the results. The div 'wiki wikiPage' has the spell data in it. I want to get just that div and display it. Sadly I can’t connect to any form of database with spells, it is hosted by Wikispaces and they don’t allow that.</p> <p>I hope this has been clear, ask me for more details if you like. Here is what I have so far:</p> <pre><code>&lt;?php if(isset($_POST['submit'])) { $spell=$_POST['spell']; $pvpwiki="http://pvpzone.wikispaces.com/"; $site=$pvpwiki . $spell; $submit=true; } ?&gt; &lt;!DOCTYPE html&gt; &lt;html lang="en"&gt; &lt;head&gt; &lt;meta http-equiv="content-type" content="text/html; charset=utf-8"&gt; &lt;title&gt;Spell search&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form name="spellsearch" id="spellsearchform" method="post" action="&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;"&gt; &lt;input type="text" name="spell" value="&lt;?php if(!isset($_POST['submit'])){echo("Vanish");}?&gt;"&gt;&lt;/input&gt; &lt;input type="submit" value="Search" name="submit"&gt;&lt;/input&gt; &lt;/form&gt; &lt;?php $doc = new DomDocument; $doc-&gt;validateOnParse = true; $doc-&gt;loadHtml(file_get_contents($site)); var_dump($doc-&gt;getElementById('wiki wikiPage')); if($doc == false &amp;&amp; $submit) { echo("&lt;br /&gt;" . "That is not a spell!"); } ?&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>My problem right now is I am getting a parse error (Warning: DOMDocument::loadHTML() [domdocument.loadhtml]: ID target_editor already defined in Entity, line: 212 in /home/content/d/e/x/dext0459/html/russellsayshi/phpspellsearch.php on line 24 NULL), I would really appreciate your help.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload