Jul 192012
 
$url = 'http://www.personalisedmemento.co.uk/product.php/pid-'.$row['SKU'].'/';

$homepage = file_get_contents($url);
//echo $homepage;

preg_match_all("/<p[^>]*class=\"blackText11\">(.*?)<\\/p>/si", $homepage, $match);
//print_r($match) ;

echo $cate_text = $match[1][1];
echo '<pre>';
preg_match_all('#<a\s+.*?href=[\'"]([^\'"]+)[\'"]\s*(?:title=[\'"]([^\'"]+)[\'"])?.*?>((?:(?!</a>).)*)</a>#i', $cate_text, $match_new);

print_r($match_new) ;

$cat_name = $match_new[3];
$cat_link = $match_new[1];
$cat_string='';
for($i=0;$i<sizeof($cat_link);$i++)
{
	echo $cat_name[$i].'-'.$cat_link[$i];
}

  One Response to “Scrapping data from URL by PHP script”

  1. Hi, really like the appearance of ones website. Can you mind saying what theme youre making use of? I’m not used to this and i am hoping to have mine looking anywhere close to cool as yours. Many thanks.

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>