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

The Archive Base Latest Questions

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

I have a script which I think is pretty basic scraping, call it what

  • 0

I have a script which I think is pretty basic scraping, call it what you will, but it takes on average at least 6 seconds…is it possible to speed it up? The $date variables are only there for timing the code and don’t add anything significant to the time it takes. I have set two timing markers and each is approx 3 seconds between. Example URL below for testing

$date = date('m/d/Y h:i:s a', time());

echo "start of timing $date<br /><br />"; 

include('simple_html_dom.php');

function getUrlAddress()
{
$url = $_SERVER['HTTPS'] == 'on' ? 'https' : 'http';
return $url .'://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
}

$date = date('m/d/Y h:i:s a', time());  echo "<br /><br />after geturl $date<br /><br />";

$parts = explode("/",$url);

$html = file_get_html($url);

$date = date('m/d/Y h:i:s a', time());  echo "<br /><br />after file_get_url $date<br /><br />";

$file_string = file_get_contents($url);
preg_match('/<title>(.*)<\/title>/i', $file_string, $title);
$title_out = $title[1];

foreach($html->find('img') as $e){

    $image = $e->src;

    if (preg_match("/orangeBlue/", $image)) { $image = ''; }

    if (preg_match("/BeaconSprite/", $image)) { $image = ''; }

    if($image != ''){

    if (preg_match("/http/", $image)) { $image = $image; }

    elseif (preg_match("*//*", $image)) { $image = 'http:'.$image; }

    else { $image = $parts['0']."//".$parts[1].$parts[2]."/".$image; }

    $size = getimagesize($image);
    if (($size[0]>110)&&($size[1]>110)){
    if (preg_match("/http/", $image)) { $image = $image; }
    echo '<img src='.$image.'><br>';
    }
    }
    }

$date = date('m/d/Y h:i:s a', time());  echo "<br /><br />end of timing $date<br /><br />";

Example URL

UPDATE

This is actual what timing markers show:

start of timing 01/24/2012 12:31:50 am

after geturl 01/24/2012 12:31:50 am

after file_get_url 01/24/2012 12:31:53 am

end of timing 01/24/2012 12:31:57 am

http://www.ebay.co.uk/itm/Duke-Nukem-Forever-XBOX-360-Game-BRAND-NEW-SEALED-UK-PAL-UK-Seller-/170739972246?pt=UK_PC_Video_Games_Video_Games_JS&hash=item27c0e53896`
  • 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-28T07:50:44+00:00Added an answer on May 28, 2026 at 7:50 am

    It’s probably the getimagesize function – it is going and fetching every image on the page so it can determine the size. Maybe you can write something with curl to get the header only for Content-size (though, actually, this might be what getimagesize does).

    At any rate, back in the day I wrote a few spiders and it’s kind of slow to do, with internet speeds better than ever it’s still a fetch for each element. And I wasn’t even concerned with images.

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

Sidebar

Related Questions

I have a script which will be run interactively by non-technical users. The script
I have a script which contacts a few sources and tell them the IP-address
I have a script which logs on to a remote server and tries to
I have this script which basically toggles a bgColor class on and off so
I have a script which hides (display:none) certain divs in the list on page
I have a script which creates a user-defined object like this: obj = new
I have a script which, each time is called, gets the first line of
I have a script which tracks visits & referers to a website. I send
I have a script which returns a price for a product. However, the price
I have a script which collects an image, link and some text content from

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.