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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:49:57+00:00 2026-06-17T08:49:57+00:00

I need a script that accepts this ul: <ul id=activitylist> <li class=activitybit forum_thread> <div

  • 0

I need a script that accepts this ul:

<ul id="activitylist">
    <li class="activitybit forum_thread">
        <div class="avatar"> <img alt="secret team's Avatar" src="images/misc/unknown.gif" title="secret team's Avatar"> </div>
        <div class="content hasavatar">
        <div class="datetime"> <span class="date">Today,&nbsp;<span class="time">11:25pm</span></span> </div>
        <div class="title"> <a class="username" href="member.php/436070-secret-team">secret team</a> started a thread <a href="showthread.php/415403-Allow-VIDEO-Code-missing-in-settings">'Allow [VIDEO] Code' missing in settings</a> </div>
        <div class="views">0 replies | 0 view(s)</div>
    </li>
</ul>

There are 10 to 15 child li in one ul. I need thread name of every child li where thread has 0 replies. I posted one example li above. So for that example I need this text:

'Allow [VIDEO] Code' missing in settings

where this div has 0 replies as a text:

 <div class="views">0 replies | 0 view(s)</div>

I have this sample code but it is not working correctly.

<?php
$request_url = 'https://www.vbulletin.com/forum/activity.php';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $request_url); // The url to get links from
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // We want to get the respone
$result = curl_exec($ch);

$sPattern = "/<li class=\"activitybit forum_thread\">(.*?)<\/li>/s";
preg_match_all($sPattern, $result, $parts);
$links = $parts[1];
foreach ($links as $link) {
    if (stripos($link, "0 replies") !== false) {
        echo $link . "<br>";
    }
}
curl_close($ch);
?>
  • 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-17T08:49:58+00:00Added an answer on June 17, 2026 at 8:49 am

    Here is a regex that will parse any kind of HTML:

    $regex = new DOMDocument;
    $regex->loadHTML($html);
    

    Now serious. DOMDocument has parsed all of your HTML. You can now use these and these functions to walk over tags and extract their attribute and contents. But it is much easier to use a companion class called DOMXPath:

    $xpath = new DOMXpath($regex);
    foreach ($xpath->query("//ul[@id='activitylist']/li") as $li) {
        $view = $xpath->query(".//div[@class='views']", $li)->item(0);
        $link = $xpath->query(".//div[@class='title']/a", $li)->item(1);
        if (preg_match("/0 replies/", $view->nodeValue)) {
            echo $link->nodeValue . " (" . $link->getAttribute("href") . ")\n";
        }
    }
    

    This will output few warnings about your HTML not being perfect plus this:

    'Allow [VIDEO] Code' missing in settings (showthread.php/415403-Allow-VIDEO-Code-missing-in-settings)
    

    You can read more about using Regex PHP to parse HTML here. A comprehensive list of XPath examples is available here.

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

Sidebar

Related Questions

I need to Write a Unix shell script that accepts two or more arguments,
So I have this existing command that accepts a single argument, but I need
I need a script that will test an input field's contents to see if
I need a script that simply formats a value (eg 4567643) to (4,567,643). No
I need a script that inserts a number at some point into a file
I need a script that will insert the current date and time in an
Pretty simple: I need a script that reads the element ij of TWO images
i need an sql script that is going to change the datasource of all
I need an Autohotkey script that puts the selected text in these opening and
I need to run a script that will generate the projects.list file when a

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.