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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.