Jump to content

scrape an image


croakingtoad

Recommended Posts

I've tried several times to get this to work and nothing I have tried has been successful.

 

I want to scrape the below url--

 

http://www.alexa.com/data/details/traffic_details/instantaction.com?site0=virginia.edu&site1=vt.edu&site2=ncsu.edu&site3=psu.edu&site4=umd.edu&y=r&z=3&h=300&w=610&u%5B%5D=virginia.edu&u%5B%5D=vt.edu&u%5B%5D=ncsu.edu&u%5B%5D=psu.edu&u%5B%5D=umd.edu&x=2008-03-20T13%3A39%3A43.000Z&check=alexa.com&signature=53LsuknqIBOvifzf%2FUFCNr6WyLI%3D&range=6m&size=Medium

 

for the following image to write to my own server once a day--

<img src="http://widgets.alexa.com/traffic/graph/?r=6m&y=r&z=3&h=300&w=610&u%5B%5D=virginia.edu&u%5B%5D=vt.edu&u%5B%5D=ncsu.edu&u%5B%5D=psu.edu&u%5B%5D=umd.edu&x=2008-03-20T13%3A40%3A54.000Z&check=www.alexa.com&signature=VH1glT4ZwCzDnpmKzXEEsG9isNs%3D" id="alexagraph"/>

 

I've tried using the tools found here-- http://www.troywolf.com/articles/php/class_http/

but haven't been able to get anywhere.  I'll post what I had below--

 

$http = 'http://www.alexa.com/data/details/traffic_details/instantaction.com?site0=virginia.edu&site1=vt.edu&site2=ncsu.edu&site3=psu.edu&site4=umd.edu&y=r&z=3&h=300&w=610&u%5B%5D=virginia.edu&u%5B%5D=vt.edu&u%5B%5D=ncsu.edu&u%5B%5D=psu.edu&u%5B%5D=umd.edu&x=2008-03-20T13%3A39%3A43.000Z&check=alexa.com&signature=53LsuknqIBOvifzf%2FUFCNr6WyLI%3D&range=6m&size=Medium';
$uri = urlencode($http);

echo "Step 1<br /><br />";

require_once("assets/php/class_http.php");
$h = new http();

if (!$h->fetch($uri, "daily")) {

  echo "<h2>There is a problem with the http request!</h2>";
  echo $h->log;
  exit();
}

 

and here's the response I rec'd-

New http() object instantiated.
--------------------------------
fetch() called
url: http%3A%2F%2Fwww.google.com%2Flogos%2Fspring08.gif
Filename: /www/virtualhosts/www.dashboard.unirel.vt.edu/http_5f3bca03a10708837ce5ed5e2500b772
getFile_ts() called
/www/virtualhosts/www.dashboard.unirel.vt.edu/http_5f3bca03a10708837ce5ed5e2500b772 does not exist
cache has expired
getFromUrl() called
Could not open connection. Error -1215900454: 

Link to comment
https://forums.phpfreaks.com/topic/97077-scrape-an-image/
Share on other sites

It looks like Alexa uses javascript to show the real graph once the html has loaded. So when you scrape the HTML of the URL, you won't get the path to the real graph image. Guess you have to use their 3-comparison widget (they obviously don't want you to scrape their graph). Or find another service.

Link to comment
https://forums.phpfreaks.com/topic/97077-scrape-an-image/#findComment-496762
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.