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

  • SEARCH
  • Home
  • 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 8456935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:40:37+00:00 2026-06-10T12:40:37+00:00

I have class ClassA and want to use simple_html_dom’s function in this class. How

  • 0

I have class ClassA and want to use simple_html_dom’s function in this class. How can I do that?
This’s link of simple_html_dom class http://www.megafileupload.com/en/file/366382/simple-html-dom-rar.html

  • 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-10T12:40:39+00:00Added an answer on June 10, 2026 at 12:40 pm
    <?php
        Class A
        {
            private $simpleHTML;
    
            function __construct()
            {
                $this->simpleHTML = new simple_html_dom(); 
                //now you can call all simple html functions using $this->simpleHTML->..
            }
    
            //define file_get_html as a class method. You can call this as 
            // $x = new A();
            //$x->file_get_html..(externally) or $this->file_get_html(.. (internally)
            function file_get_html($url, 
                            $use_include_path = false, 
                            $context=null, $offset = -1, 
                            $maxLen=-1, $lowercase = true, 
                            $forceTagsClosed=true, 
                            $target_charset = DEFAULT_TARGET_CHARSET, 
                            $stripRN=true, 
                            $defaultBRText=DEFAULT_BR_TEXT)
            {
                // We DO force the tags to be terminated.
                $dom = new simple_html_dom(null, $lowercase, $forceTagsClosed, $target_charset, $defaultBRText);
                // For sourceforge users: uncomment the next line and comment the retreive_url_contents line 2 lines down if it is not already done.
                $contents = file_get_contents($url, $use_include_path, $context, $offset);
                // Paperg - use our own mechanism for getting the contents as we want to control the timeout.
                //$contents = retrieve_url_contents($url);
                if (empty($contents))
                {
                    return false;
                }
                // The second parameter can force the selectors to all be lowercase.
                $dom->load($contents, $lowercase, $stripRN);
                return $dom;
            }
        }
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an AS3 class with some getVideo function. I want to use this
I have a wrapper class around some objects that I want to use as
I have an issue regarding Sendkeys Class, as i want to use this class
I have a class ImageBean and I want to use it to load images
I have a class I model bind and I want to use output caching
I have created a public static class utils.cs I want to use it in
I have a UIWebView named wView. I want to use webViewDidFinishLoad: in my class,
I have this class: class OriginalClass { string FirstItem; List<string> ListOfSecondItems; } I want
I have a class: class node { public: node& parent; } I want to
I have a form in spring mvc 2 having command class Class1 I want

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.