Jump to content

PHP Web Scraper???


thinkaboutit

Recommended Posts

Last question... At least I hope. I ran a test scrap on the following using the following code which isn't spitting out anything. Hmmm... I test it with the Yahoo Finance and it works fine. Suggestions?

 

<?
require_once ("class_scraper.php");

// Get html --------
$o_sc = new scraper();
$s_html = $o_sc->fetch("http://www.magicyellow.com/category/General_Contractors/Denver_CO.html");

// Delimit start and end of patterns
$s_start_pattern = "<td class";
$s_end_pattern = "</td>";

// Pattern structure
$s_model = '<tr
<td class="lName" colspan=2 width="100%">
<field>
</td>
<strong style="font-size: 11px;">
<field>
</strong>
<td colspan=2>
<field>
<br>
';

$a_result = $o_sc->extract($s_html, $s_start_pattern, $s_end_pattern, $s_model);
print_r ($a_result);

?>

Link to comment
https://forums.phpfreaks.com/topic/81558-php-web-scraper/#findComment-414196
Share on other sites

To give you a brief run down - I am interested in pulling all the data below for each individual listing: This is from the following page: http://www.magicyellow.com/category/General_Contractors/Denver_CO.html.

 

What my ultimate goal here is to have it auto populate listings based upon category and location.  ???

 

<tr valign="top">
								<td class="lName" colspan=2 width="100%">

									SPECTRUM GENERAL CONTRACTORS
								</td>

								<td rowspan="2" align="right" nowrap>

									<strong style="font-size: 11px;">303-329-8003</strong> <br>										
										 											
										<br><a href="/review.cfm?MYID=14231297" title="Write a review for SPECTRUM GENERAL CONTRACTORS"><img src="/writeAreview.gif" width="76" height="12" alt="" border="0"></a>

								</td>
							</tr>				
								<tr>
									<td colspan=2>
										5135 E 38th Ave<br>
										Denver, CO 80207
									</td>
								</tr>

Link to comment
https://forums.phpfreaks.com/topic/81558-php-web-scraper/#findComment-414211
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.