1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Extracting Data

Discussion in 'PHP' started by adamjblakey, Mar 4, 2008.

  1. #1
    Hi,

    How would i go about doing the following.

    I have a URL like this e.g. www.website.co.uk/orgs-details.asp?OrgsID=

    On this page there is Company Name, Contact:, Tel, E-mail: and Web site:

    I want to extract these details and add them into a table.

    How would i do this?

    This is how the data is shown if this helps?
    <table width="385" border="0" cellspacing="0" cellpadding="0"> 
                  <tr> 
                    <td valign="top"><h1>Company Name</h1> 
                      <table width="100%" border="0" cellspacing="0" cellpadding="3"> 
                        <tr> 
                          <th width="30%"><strong>Contact:</strong></th> 
                          <td width="70%"><strong>Persons Name 
                            </strong> </td> 
                        </tr> 
                         
                        <tr> 
                          <th><strong>Tel:</strong></th> 
                          <td><strong>000 000 000</strong></td> 
                        </tr> 
                        <tr> 
                          <td>&nbsp;</td> 
                          <td><span class="small">Information Here</span>.</td>
    
                        </tr>
                         
                        <tr> 
                          <th><strong>E-mail:</strong></th> 
                          <td><strong><a href="info&#64;website.com">info&#64;website.com</a></strong></td> 
                        </tr> 
                         
                        <tr> 
                          <th><strong>Web site:</strong></th> 
                          <td><strong><a href="http://www.website.com" target="_blank" id="451" onClick="return trackclick(this.id);" title="Visit Site">www.website.com</a></strong></td> 
                        </tr> 
                         
                      </table>
    Code (markup):

    Cheers,
    Adam
     
    adamjblakey, Mar 4, 2008 IP
  2. smatts9

    smatts9 Active Member

    Messages:
    1,089
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    88
    #2
    I'm guessing you're taking other's information? But anyway you can use a CURL function.
     
    smatts9, Mar 4, 2008 IP
    guerilla likes this.
  3. swishman

    swishman Well-Known Member

    Messages:
    1,264
    Likes Received:
    28
    Best Answers:
    0
    Trophy Points:
    140
    #3
    i dont think that curl is the right way for this dont you?
    any way try it..
    for me its private info :))
     
    swishman, Mar 4, 2008 IP
  4. adamjblakey

    adamjblakey Active Member

    Messages:
    1,121
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    80
    #4
    Do you have any example of how i could use this curl function to do so?
     
    adamjblakey, Mar 4, 2008 IP
  5. adamjblakey

    adamjblakey Active Member

    Messages:
    1,121
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    80
    #5
    Could something like this be adapted to work that i have used in the past to extract email addresses:

    
    for($i=1;$i<$max_val;$i++) {
      $content = file_get_contents('http://www.website.com/slist.php?item='.$i);
      preg_match_all($email_match_regex, $content, $matches);
          if(count($matches[0])) {
                foreach($matches[1] as $index => $value) {
                        $insert_id = mysql_query('INSERT INTO.....');
                }
         }
    }
    
    PHP:
     
    adamjblakey, Mar 5, 2008 IP