Screen Scrape Issue preg_match
Collapse
This topic is closed.
X
X
-
cainwebdesign@gmail.comTags: None -
Rik
Re: Screen Scrape Issue preg_match
cainwebdesign@g mail.com wrote:preg_match('|<d iv[^>]*?id="toShow"[^>]*>.*?<img[^>]*?src="([^"]*)"|si',$htm
l,$match);
$src = $match[1];
--
Grtz,
Rik Wasmus
-
cainwebdesign@gmail.com
Re: Screen Scrape Issue preg_match
Rik,
Thanks but can you take a quick look, i still can see to get it to
work.
<?php
$html =
file_get_conten ts('http://www.toysrus.com/product/index.jsp?produ ctId=2327085');
preg_match('|<d iv[^>]*?id="toShow"[^>]*>.*?<img[^>]*?src="([^"]*)"|si',$html,$ match);
$src = $match[1];
echo $src;
?>
Rik wrote:cainwebdesign@g mail.com wrote:>
preg_match('|<d iv[^>]*?id="toShow"[^>]*>.*?<img[^>]*?src="([^"]*)"|si',$htm
l,$match);
$src = $match[1];
>
--
Grtz,
>
Rik WasmusComment
-
Rik
Re: Screen Scrape Issue preg_match
cainwebdesign@g mail.com wrote:Rik,
Thanks but can you take a quick look, i still can see to get it to
work.
The reason is as simple as evil.
When opening it with PHP, the page terminates prematurely on:
<!-- useragent: null -->
They rely on user-agent detection to build the rest of their page, and
don't revert to anything if it's not recognized.
To gather the HTML, you're best of using CURL, and fake a User-Agent.
--
Rik Wasmus
Comment
-
cainwebdesign@gmail.com
Re: Screen Scrape Issue preg_match
Rik,
Would you be interested in doing this for me? I can pay you through
paypal?
You can respond through here and I can then contact you through your
email attached?
Rik wrote:cainwebdesign@g mail.com wrote:>Rik,
Thanks but can you take a quick look, i still can see to get it to
work.
>
The reason is as simple as evil.
>
When opening it with PHP, the page terminates prematurely on:
<!-- useragent: null -->
>
They rely on user-agent detection to build the rest of their page, and
don't revert to anything if it's not recognized.
>
To gather the HTML, you're best of using CURL, and fake a User-Agent.
--
Rik WasmusComment
Comment