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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:52:10+00:00 2026-05-29T10:52:10+00:00

The code from original web page <html> <div class=clear></div> <div class=slider> <ul> <li> <a

  • 0

The code from original web page

<html>
<div class="clear"></div>
<div class="slider">
<ul>  
<li>
<a title="title1" href="http://www.link.com" >
<img  title="title1"  alt=""  src="http://www.link.com/1.jpg"  /></a>
</li>
<li>
<a title="title2" href="http://www.link.com" >
<img  title="title2"  alt=""  src="http://www.link.com/2.jpg"  /></a>
</li>
</ul>
</div>
<div class="clear"></div>
</html>

and I want to extract below details (with tags) same as below

<div class="slider">
<ul>  
<li>
<a title="title1" href="http://www.link.com" >
<img  title="title1"  alt=""  src="http://www.link.com/1.jpg"  /></a>
</li>
<li>
<a title="title2" href="http://www.link.com" >
<img  title="title2"  alt=""  src="http://www.link.com/2.jpg"  /></a>
</li>
</ul>
</div>

Checked many questions posted before but I can’t find something similar to this so Please someone help me with this.

Thanks

  • 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-29T10:52:11+00:00Added an answer on May 29, 2026 at 10:52 am

    To manipulate HTML it is better not to use regular expressions like preg_replace. Why? See this question. You can use phpQuery as HTML parser.

    Install it with the following commands (you need pear):

    pear channel-discover phpquery-pear.appspot.com  
    pear install phpquery/phpQuery 
    

    After installing, you can do the following:

    <?php
    $html = file_get_contents("http://www.your-url.com/");
    $pq = phpQuery::newDocumentHTML($html);
    echo $pq['.slider']; // Output the contents of tags with class="slider"
    

    For more example code and documentation, please take at the phpQuery web page

    Edit:

    If you want to use another HTML parsing solution, you can take a look at How do you parse and process HTML/XML in PHP?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

from this code will show in original color how can i change it to
I have built an open-source application from the source code. Unfortunately, the original executable
UPDATE: Perhaps this wasn't clear from my original post, but I'm mainly interested in
A web page is loaded from the Internet in a windowless IHTMLDocument for future
I have a Chrome extension which is injecting some code into a web page
I need a technology to: a) From the a browser, a web page, browse
This is my first time to paint a client web page from inside a
Porting code from 32bit to 64bit. Lots of places with int len = strlen(pstr);
Here's the code from the ascx that has the repeater: <asp:Repeater ID=ListOfEmails runat=server >
Here is my sample code: from xml.dom.minidom import * def make_xml(): doc = Document()

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.