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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T02:18:54+00:00 2026-05-20T02:18:54+00:00

Retrieving a value inside of a span id? <span id=playerCount>157,767 people currently online</span> How

  • 0

Retrieving a value inside of a span id?

<span id="playerCount">157,767 people currently online</span>

How would I go about getting the value inside that ID? I thought of preg_match() but is that even safe?

  • 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-20T02:18:55+00:00Added an answer on May 20, 2026 at 2:18 am

    Use php’s DOM methods. The following code assumes you have allow_url_fopen enabled:

    $domd = new DOMDocument();
    libxml_use_internal_errors(true);
    $domd->loadHTML(file_get_contents($url));
    libxml_use_internal_errors(false);
    
    $span = $domd->getElementById("playerCount");
    $span_contents = $span->textContent;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm retrieving a value within an emitted code block that I would like to
How would one go about retrieving a dependent/parent object from an entity. $person->getAddress(); This
I have used a join query for retrieving value from two tables one is
I'm retrieving a float value from a mysql database on a php page (2.5,
I can grab a random value from an array-like structure by retrieving a random
I'm having trouble storing and retrieving a float in NSUserDefauts. I store the value,
I have a PlaceHolder control inside of a ListView that I am using to
I have a problem retrieving all the data inside the rows added by the
If I am retrieving a value from a database which could be Null ,
I have a query on retrieving data sent as JSON from a JavaScript, inside

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.