Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8573523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:16:14+00:00 2026-06-11T19:16:14+00:00

I need a way to get only an element with a certain ID and

  • 0

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.

To be more specific on what I want, I am making a spell search for a minecraft server. Our website is http://pvpzone.org/ and wiki is at http://pvpzone.wikispaces.com/. 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.

I hope this has been clear, ask me for more details if you like. Here is what I have so far:

<?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>

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T19:16:15+00:00Added an answer on June 11, 2026 at 7:16 pm

    The error message you see is just a warning:

    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

    You can ignore those, they don’t stop you. If you see them on your website, you have not configured it properly, you should log errors, not display them.

    Anyway in that case for that library you can disable them this way, too:

    libxml_use_internal_errors(true);
    

    call it before loading the HTML. That HTML btw. didn’t cause the error when I tried with that website.

    The next mistake is that you are looking for a class not for an ID. Look for the ID instead:

    $div = $doc->getElementById('content_view');
    

    The whole code example:

    function get_wiki_page_div($page)
    {
        $url = sprintf('http://pvpzone.wikispaces.com/%s', urlencode($page));
    
        $doc = new DOMDocument();
        $doc->validateOnParse = true;
        libxml_use_internal_errors(true);
    
        $doc->loadHTMLFile($url);
    
        $div = $doc->getElementById('content_view');
    
        if (!$div) {
            return false;
        }
    
        return $doc->saveXML($div);
    }
    

    Usage:

    <?php
    $submit = isset($_POST['submit']);
    if ($submit)
    {
        $spell  = $_POST['spell'];
        $result = get_wiki_page_div($spell);
    }
    ?>
    
    ...
    
    
    <?php
    if ($submit)
    {
        echo $result ? $result : '<div>This is not a Spell!</div>';
    }
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to get the text that is inside a element. I can only
I'm working with Android and I really need a fast way to get a
I need to find a way to get actual page size in Google Chrome.
Is there a way to get the size at runtime ? I need to
To do some WCF benchmarking, I need to have a way to get the
I need to define an appender for log4net in a way that I get
Normally, we get first value that way: $(#color option:first).val() But I need something like
I've selected the following element. What's the best way to get the class name
I have a Joomla-Based website and as far as I know, the only way
For example $('.some-class') returns 3 elements. I need to get only one of them,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.