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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:43:36+00:00 2026-05-28T18:43:36+00:00

I have a page with many HTML lines like this: <ul><li><a href=’a_silly_link_that_changes_each_line.php’>the_content_i_need</a></li></ul> Now as

  • 0

I have a page with many HTML lines like this:

<ul><li><a href='a_silly_link_that_changes_each_line.php'>the_content_i_need</a></li></ul>

Now as you can see, theres a link in that line, which unfortunately changes on each line.

So I need a way to scrape the content in that line, without letting the link get in the way.

I’ve also tried to scrape like this: .php'>(*.)</a></li></ul> but thats no good, as it returns allot of unwanted content.

Also, because there are many lines on the page that i need to take the content from, could i just loop through, somehow?

I’m using preg_match and file_get_contents but am open to other suggestions. 🙂

  • 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-28T18:43:37+00:00Added an answer on May 28, 2026 at 6:43 pm

    From: PHP Parse HTML code

    Use something like:

       $str = '<ul><li><a src="test.html">linky</a></li></ul>';
       $DOM = new DOMDocument;
       $DOM->loadHTML($str);
       $items = $DOM->getElementsByTagName('ul');
        for($i =0;$i<$items->length;$i++){
            $ul = $items->item($i);
            $li=$ul->firstChild;
            if($li->nodeName=='li' && $li->firstChild->nodeName=='a'){
                //do something with $li->firstChild->nodeValue 
    
            }
        }
    

    In this case, $li->firstChild->nodeValue will be linky.

    That should do it 🙂

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

Sidebar

Related Questions

I have a menu structure that looks like this: HTML: <li> <a href=#page> <b>Recover
how can i do. i have many html elements on page. after clicking on
Suppose on my HTML page I have many href s to a link. Using
I have a Page with many Comments. Many users can access this page and
I have a page that look like this. <html> <head> <title>Welcome</title> </head> <body bgcolor=white
If I have a single page with many forms of existing records: index.html.haml -
In our HTML page, we have a list of tags to load in many
I have a page consisting of many elements with alphanumeric ids such as this:
I have a page which has many event handlers. The code now reached 1000+
I have a partial now looking like this: <%= render(:partial => 'order', :object =>

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.