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 7406451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:33:35+00:00 2026-05-29T05:33:35+00:00

I want to load content of a specific div with class=’box’ from a webpage,

  • 0

I want to load content of a specific div with class='box' from a webpage, and I used Simple HTML DOM for this. but I can’t write a clear pattern for preg_match, here is my php code:

<?php
   $url = "http://www.example.com/pages/";
   $page_all = file_get_contents($url); 

   preg_match(...?);


   echo "<pre>";
   print_r($div_array[0]);
   echo "</pre>";
?>

Please help me to write a right pattern for preg_match

  • 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-05-29T05:33:36+00:00Added an answer on May 29, 2026 at 5:33 am

    SimpleHtmlDOM :

    $html = new simple_html_dom();
    
    // Load from a string
    $html->load('<html><body><p>Hello World!</p><p>We're here</p></body></html>');
    
    // Load a file
    $html->load_file('http://net.tutsplus.com/');
    
    # get an element representing the second paragraph  
    $element = $html->find("div[class=box1]");
    
    #access HTML attr
    $element->innertext .= "Somthing";
    
    #save and echo
    echo $element->save();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to load a dynamic content to specific div name with multiple querystring
I have a JSON file which contains HTML content. I want to load it
Let's say I use jQuery to load new content into a specific DIV element.
I'm trying to load content into a Dojo content pane in a specific html
I want to pull only a specific div from the page my link is
So...um, how can I load a specific DIV from a page loaded via ajax?
I want to load data from MySql database to a HTTP form When I
I want to load PNG-file from resources. There is a roughly MFC-way (with CResourceStream
I'm using jQuery address to enable loading specific content from other pages and to
I'm trying to load images from the specific folder in sd card.i saved images

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.