Get Email address from Javascript with Simple HTML Dom

5 replies
Hi there,

I was trying to figure this out for more than one day with no success... I am using simple html dom and this is what my code looks like.

Code:
<?php 

include('simple_html_dom.php');

$html = file_get_html('http:// zameen. com/Profile/Islamabad-Patiala_Associates-28879-1.html');

$emailid = $html->find('.s:22', 0);

echo $emailid;

?>
This is what Javascript in above link looks like

Code:
<script language="javascript">var stats_data_obj_agent = 'a:1:{s:16:"agent_phone_view";a:1:{i:137839;a:18:{s:4:"ph_v";i:1;s:11:"with_a_logo";i:1;s:8:"featured";i:1;s:5:"loc_2";s:4:"1562";s:5:"loc_3";s:1:"3";s:6:"cat_id";s:1:"3";s:12:"agent_userid";s:6:"137839";s:12:"company_name";s:16:"Test Estate";s:13:"company_phone";s:14:"+1-2345678";s:12:"company_cell";s:14:"+1-2345678";s:13:"company_email";s:22:"abcd1234@gmail.com";s:9:"is_active";i:1;s:9:"curr_code";s:3:"USD";s:5:"actid";N;s:7:"actname";N;s:8:"actphone";N;s:7:"actcell";N;s:8:"actemail";N; } '; </script>
I am new to this so not yet familiar with advance methods. Any help would be appreciated. Thank you!
#address #dom #email #html #javascript #simple
  • Profile picture of the author KirkMcD
    You need to execute the JS.
    But anyway, you're not trying to scrape email addresses are you?
    {{ DiscussionBoard.errors[9961120].message }}
  • Profile picture of the author hassan007
    I am trying to scrape email and few other values from this page for a local free directory project
    {{ DiscussionBoard.errors[9962338].message }}
  • Profile picture of the author KirkMcD
    Yeah, scraping emails is kinda illegal.
    {{ DiscussionBoard.errors[9962607].message }}
    • Profile picture of the author Karen Blundell
      that's why it is so much better to use a contact form on a website rather than post a live email address link - don't do it or you'll have people like the OP scraping them and using them for their own nefarious reasons
      Signature
      ---------------
      {{ DiscussionBoard.errors[9962663].message }}
      • Profile picture of the author rts2271
        Scraping emails on your own site is fine. Scraping them from a domain you do not own can be bad. It is not illegal to scrape emails, the problem comes that unless you have a very slick targeting regex to get your emails your going to have a potential for a ton of dirty emails.Not to mention it is considered bad practice to not have some kind of permission.

        Example of good scraping. Software company X is looking for the administrator emails of domains who utilize X brand of software. They use search results obtained from Google to generate a list of people using product X and who have contact info on their page. They use that list and generate a initial contact to those leads. Yes perfectly 100% legal.

        Example of bad scraping. Pulling all email addresses of a web page you do not own. Yes perfectly 100% legal.
        {{ DiscussionBoard.errors[9963512].message }}

Trending Topics