Jump to content

j5uh

Members
  • Posts

    58
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

j5uh's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. ic. well if this is agains't phpfreaks forums TOS, please delete this thread. I don't want to cause any trouble.
  2. well if this script is illegal than i am sorry. moderators, please remove it. if not someone help me out
  3. ooh. did not know this. but there are actual softwares being sold that does the scraping. How are they getting away with that?
  4. I found this AWESOME yellowpages scraper online for free instead of paying someone to scrap the pages... http://www.scrapingpages.com/ I've tested the code here: <? ini_set('memory_limit', '99999M'); function createUrl($url,$lastnum) { $find = "?"; $trim = rtrim ($url,'a..z,A..Z,=,_,&'); $remove_to = strpbrk($trim, '?'); $number = 1; $counter= 0; while ($lastnum != $number) { $over = "?page=".$number."&"; $replace = str_replace($find,$over,$url); $myArray[$counter] = $replace; $number++; $counter++; } return $myArray; } $url = "http://www.yellowpages.com/TX/Internet-Marketing-Advertising?search_mode=all&search_terms=seo"; $lastnum = 1 +1; $url = createUrl($url,$lastnum); function createList ($url ) { $counter=0; foreach ($url as $value) { $html=file_get_contents ($value); $myArray[$counter] = $html; $counter++; } return $myArray; } $list = createList($url); foreach ($list as $value){ echo "<span style='width:8px; background:blue'> </span>"; preg_match_all ("/<div class=\"description\">([^`]*?)<\/div>/", $value, $matches); foreach ($matches[0] as $match) { preg_match ("/<h2>([^`]*?)<\/h2>/", $match, $temp); preg_match ("/<p>([^`]*?)<\/p>/" , $match, $desc); preg_match ("/<ul>([^`]*?)<\/ul>/" , $match, $num); $title = $temp['1']; $title = strip_tags(trim($title)); $description = $desc['1']; $description = strip_tags(trim($description)); $phone = $num['1']; $phone = strip_tags(trim($phone)); print "<b>$title</b> <br>$description<br> $phone<br> <br>"; } } ?> Works great but how do I get it to search more than 50+ pages...? I want to scrape all the houston businesses but it times out at 50 or so pages. Is there a way to modify this code to search maybe 50 pages at a time or something? like scrape pages 1-50, than 51-100, etc. etc.
  5. honestly, i wish it was easier to integrate paypal into a form.. but i have no experience with API's...
  6. so could I do this? <?php $referal = $_SERVER['HTTP_REFERER']; if (preg_match('~^https?://(.*?\.)?paypal.com/.*?$~D', $referal)) { <html> <body>paid content here</body> <html> } else { <html> <body>you must pay first... </body> <html> } ?>
  7. HIGHLY addicted. I've even bought a book and i'm reading about php everyday now.
  8. So this script here is better with preg_match? so if someone made a payment on paypal, they would be forwarded to this page and it should allow them to access it right? I have no problem with just a few people sneaking by... I will review the list every couple weeks to make sure people have paid...
  9. so would i code it this way... <?php $allowed_referer = array("http://paypal.com", "http://phpfreaks.com"); //add the allowed sites in this array $referal = $_SERVER['HTTP_REFERER']; if (in_array($referal, $allowed_referer)){ //let them hit this page all my html code goes here } else{ do I just put a forward script here? } ?>
  10. I have a page where people can subscribe to a subscription service. This page is accessible by the internet if you just typed the url in. What I was wondering, is there a way I can use .htaccess to only allow that page to show if your coming from a paypal website... I know there should be a way to do this... :-X
  11. I've finally figured it out. here's the final code to share it with the world. #!/usr/bin/php <?php $db_host = "xxx"; $db_user = "xxx"; $db_pwd = "xxx"; $db_name = "xxx"; $db_table = "users"; $db_emailfield = "email"; mysql_connect($db_host, $db_user, $db_pwd); mysql_select_db($db_name); // read from stdin $fd = fopen("php://stdin", "r"); $email = ""; while (!feof($fd)) { $email .= fread($fd, 1024); } fclose($fd); function get_string_between($string, $start, $end){ $string = " ".$string; $ini = strpos($string,$start); if ($ini == 0) return ""; $ini += strlen($start); $len = strpos($string,$end,$ini) - $ini; return substr($string,$ini,$len); } $email = get_string_between($email, "<div class=3DSection1>", "</div>"); // handle email $lines = explode("\n", $email); // empty vars $from = ""; $subject = "your subject here"; $headers = ""; $message = ""; $splittingheaders = true; for ($i=0; $i < count($lines); $i++) { if ($splittingheaders) { // this is a header $headers .= $lines[$i]."\n"; // look out for special headers if (preg_match("/^Subject: (.*)/", $lines[$i], $matches)) { $subject = $matches[1]; } if (preg_match("/^From: (.*)/", $lines[$i], $matches)) { $from = $matches[1]; } } else { // not a header, but message $message .= $lines[$i]."\n"; } if (trim($lines[$i])=="") { // empty line, header section has ended $splittingheaders = false; } } $sql = "SELECT `$db_emailfield` FROM `$db_table`;"; $result = mysql_query($sql); while($row = mysql_fetch_assoc($result)){ $emails = $row['email']; $headers = 'MIME-Version: 1.0' . "\n"; $headers .= 'Content-type: text/html; charset=UTF-8' . "\n"; $headers .= "From: your address.com"; $ForwardTo = $emails; mail ($ForwardTo,$subject,$message,$headers); } ?>
  12. ok one more issue. now I've stuck in some code to pull the email addresses from the db, but im getting this error here: Fatal error: Cannot redeclare get_string_between() (previously declared in /home/newhost/public_html/asd/asd/mailer3.php:28) in /home/newhost/public_html/asd/asd/mailer3.php on line 28 here's the code I am using:
  13. 99% there!!! i typed this in the email nowei dowe dqwmopqwm but it's showing up like this when i get it nowei dowe = dqwmopqwm with an equal sign... how do I not make those appear?
  14. ok sweet... now I've modified it even more and this is what I have: #!/usr/bin/php <?php // read from stdin $fd = fopen("php://stdin", "r"); $email = ""; while (!feof($fd)) { $email .= fread($fd, 1024); } fclose($fd); function get_string_between($string, $start, $end){ $string = " ".$string; $ini = strpos($string,$start); if ($ini == 0) return ""; $ini += strlen($start); $len = strpos($string,$end,$ini) - $ini; return substr($string,$ini,$len); } // handle email $lines = explode("\n", $email); // empty vars $from = ""; $subject = ""; $headers = ""; $message = ""; $splittingheaders = true; for ($i=0; $i < count($lines); $i++) { if ($splittingheaders) { // this is a header $headers .= $lines[$i]."\n"; // look out for special headers if (preg_match("/^Subject: (.*)/", $lines[$i], $matches)) { $subject = $matches[1]; } if (preg_match("/^From: (.*)/", $lines[$i], $matches)) { $from = $matches[1]; } } else { // not a header, but message $message .= $lines[$i]."\n"; } if (trim($lines[$i])=="") { // empty line, header section has ended $splittingheaders = false; } } $headers = 'MIME-Version: 1.0' . "\n"; $headers .= 'Content-type: text/html; charset=UTF-8' . "\n"; $headers .= "From: xxx"; $ForwardTo = 'xxx'; mail ($ForwardTo,$subject,$message,$headers); ?> and I'm getting this : This is a multipart message in MIME format. ------=_NextPart_000_010F_01C8C663.3932C670 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Testing 1234 ------=_NextPart_000_010F_01C8C663.3932C670 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Testing 1234 ------=_NextPart_000_010F_01C8C663.3932C670-- Which means I've stripped away all that using this line: $headers = 'MIME-Version: 1.0' . "\n"; $headers .= 'Content-type: text/html; charset=UTF-8' . "\n"; But how can I get rid of that other mess?
  15. ok nvm its not working.. lol
×
×
  • 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.