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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:22:11+00:00 2026-05-26T11:22:11+00:00

I was trying to scrape imdb by following code. $url = http://www.imdb.com/search/title?languages=en|1&explore=year; $html =

  • 0

I was trying to scrape imdb by following code.

$url = "http://www.imdb.com/search/title?languages=en|1&explore=year";
$html = new simple_html_dom();
$html->load(str_replace(' ','',$data = get_data($url)));

foreach($html->find('#left') as $total_movies)
{
$content = $total_movies->plaintext;
if(preg_match("/(?<total>[0-9,]+) titles/",$content,$matches))
{
    print_r($matches);
}
echo $content."<br>";
}

get_data() is just a curl function i created.

The problem is that preg_match is not working. i don’t know why but the same thing when used work here. $content contains the text what i scrape in above code.

$content = "1-50 of 101 titles.";
if(preg_match("/(?<total>[0-9,]+) titles/",$content,$matches))
print_r($matches);
  • 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-26T11:22:11+00:00Added an answer on May 26, 2026 at 11:22 am

    The source on the site is actually:

    <div id="left">
    1-50 of 564,592
    titles.
    </div>
    

    notice the \n this would need stripping out or added to your condition.

    Heres a method to reach your goal without using any added extra library.

      <?php 
        $url = "http://www.imdb.com/search/title?languages=en|1&explore=year";
        $temp=file_get_contents($url);
    
        $xml = new DOMDocument();
        @$xml->loadHTML($temp);
    
        foreach($xml->getElementsByTagName('div') as $div) {
            if($div->getAttribute('id')=='left'){
                preg_match("#of ([0-9,]+)#",$div->nodeValue,$match);
                $matchs[]=preg_replace('/[^0-9]/', '', $match[0]);
            }
        }
    
        echo number_format($matchs[0]); //564,592
    
        ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to scrape this web page: http://www.acttab.com.au/interbet/venues?day=today Here is my code: function
I'm trying to scrape information from http://www.nfl.com/scores (in particular, find out when a game
I am trying to scrape http://www.co.jefferson.co.us/ats/displaygeneral.do?sch=000104 and get the owner Name(s) What I have
I am trying to scrape http://www.nscb.gov.ph/ggi/database.asp , specifically all the tables you get from
I'm trying to scrape this link: https://www.bu.edu/link/bin/uiscgi_studentlink/1293403322?College=SMG&Dept=AC&Course=222&Section=C1&Subject=ACCT &MtgDay=&MtgTime=&ModuleName=univschr.pl&KeySem=20114&ViewSem=Spring+2011&SearchOptionCd=C&SearchOptionDesc=Class+Subject&MainCampusInd=. (It works fine if you access
Hey can someone help with the following? I'm trying to scrape a site that
I am getting the following encoding error when trying to scrape web pages with
I'm trying to scrape a website where the URL is redirected, however programmatically trying
I'm trying to scrape a remote website. I'm using PHP Curl, and my code
Trying to scrape data from totalfilm.com using YQL but I'm getting a strange error:

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.