<?php require_once "config.php"; require_once "libs/db_mysql.php"; $SQL = new sqlQueries(PUBLIC_DATABASE_HOST, PUBLIC_DATABASE_DATABASE, PUBLIC_DATABASE_USER, PUBLIC_DATABASE_PASS); foreach ($SQL->query2assoc("SELECT `id`, `website_url` FROM " . PUBLIC_DATABASE_DATABASE . ".`startups`") as $r) { print $r['website_url'] . "\n"; //clean the urls $url = str_replace("http://", "", $r['website_url']); $url = str_replace("https://", "", $url); $url = str_replace("http:/", "", $url); $url = str_replace("https:/", "", $url); $url = str_replace("www.", "", $url); if (strpos($url, "/") > 1) { $url = substr($url, 0, strpos($url, "/")); } //$url = substr($url, 0, strpos($url, "#")); //$url = substr($url, 0, strpos($url, "?")); print $url . "\n"; $result = dns_get_record($url); print_r($result); print "\n\n"; //extract MX and SPF records foreach ($result as $line) { if ($line['type'] == "MX") { print_r($line); $dns_mx .= $line['host'] . " - " . $line['target'] . "\n"; } if ($line['type'] == "TXT" and preg_match("/spf1/", $line['txt'])) { print_r($line); $dns_spf .= $line['host'] . " - " . $line['txt'] . "\n";
<?php require_once "config.php"; require_once "libs/db_mysql.php"; $SQL = new sqlQueries(PUBLIC_DATABASE_HOST, PUBLIC_DATABASE_DATABASE, PUBLIC_DATABASE_USER, PUBLIC_DATABASE_PASS); foreach ($SQL->query2assoc("SELECT `id`, `angellist_url`, `company_name` as `angellist_url` FROM " . PUBLIC_DATABASE_DATABASE . ".`startups` where `angel_startup` =''") as $r) { //print_r($r); //clean the Angellist url if ($r['angellist_url']) { $angel_search = str_replace("https://angel.co/", "", $r['angellist_url']); $angel_search = str_replace("www.angel.co/", "", $angel_search); $angel_search = str_replace("angel.co/", "", $angel_search); $angel_search = str_replace("http://", "", $angel_search); $angel_search = str_replace("https://", "", $angel_search); $angel_search = str_replace("http:/", "", $angel_search); $angel_search = str_replace("https:/", "", $angel_search); $angel_search = str_replace("/", "", $angel_search); $angel_search = str_replace("-1", "", $angel_search); $angel_search = str_replace("-2", "", $angel_search); print $angel_search . "\n"; print "SEARCH FOR : {$angel_search} \n"; } else { //we don't have a URL but can stuill search with the company_name $angel_search = str_replace(" ", "%20", $r['company_name']); print "SEARCH FOR COMPANY : {$angel_search} \n"; } $couc = file_get_contents('https://api.angel.co/1/search?type=Startup&query=' . $angel_search . '&access_token=' . $Angellist_tokenauth); $info_search = json_decode($couc, true); print "SEARCH RESULT : \n"; print_r($info_search); $info = "";
require_once "config.php"; require_once "libs/db_mysql.php"; $SQL = new sqlQueries(PUBLIC_DATABASE_HOST, PUBLIC_DATABASE_DATABASE, PUBLIC_DATABASE_USER, PUBLIC_DATABASE_PASS); function checkTwitter($username) { require_once 'libs/Twitter/tmhOAuth-master/tmhOAuth.php'; require_once 'libs/Twitter/tmhOAuth-master/tmhUtilities.php'; $tmhOAuth = new tmhOAuth(array('consumer_key' => TWITTER_CONSUMER_KEY, 'consumer_secret' => TWITTER_CONSUMER_SECRET, 'user_token' => TWITTER_USER_TOKEN, 'user_secret' => TWITTER_USER_SECRET)); $code = $tmhOAuth->request('GET', 'https://api.twitter.com/1.1/users/lookup.json', array('screen_name' => $username)); if ($code == 200) { return json_decode($tmhOAuth->response['response'], true); } else { return false; } } foreach ($SQL->query2assoc("SELECT `id`,`twitter_url` FROM " . PUBLIC_DATABASE_DATABASE . ".`startups` where `twitter_url`!='' and twitter_followers_count=0 and twitter_url_2 is Null") as $r) { //print_r($r); $twitter = str_replace("https://twitter.com/", "", $r['twitter_url']); $twitter = str_replace("http://twitter.com/", "", $twitter); $twitter = str_replace("www.twitter.com/", "", $twitter); $twitter = str_replace("twitter.com/", "", $twitter); $twitter = str_replace("http://", "", $twitter); $twitter = str_replace("https://", "", $twitter); $twitter = str_replace("http:/", "", $twitter); $twitter = str_replace("https:/", "", $twitter); $twitter = str_replace("@", "", $twitter); print $twitter . "\n"; $res = checkTwitter($twitter); if ($res and $res[0]) { print "update " . PUBLIC_DATABASE_DATABASE . ".`startups` set `twitter_url_2` = '" . $SQL->e($res[0]['url']) . "',\n\t\t\t`twitter_url` = '" . $SQL->e($twitter) . "',\n\t\t\t`twitter_followers_count` = '" . $res[0]['followers_count'] . "',\n\t\t\t`twitter_friends_count` = '" . $res[0]['friends_count'] . "',\n\t\t\t`twitter_description` = '" . $SQL->e($res[0]['description']) . "'\n\t\t\t where id=" . $r['id']; $SQL->query("update " . PUBLIC_DATABASE_DATABASE . ".`startups` set `twitter_url_2` = '" . $SQL->e($res[0]['url']) . "',\n\t\t\t`twitter_url` = '" . $SQL->e($twitter) . "',\n\t\t\t`twitter_followers_count` = '" . $res[0]['followers_count'] . "',\n\t\t\t`twitter_friends_count` = '" . $res[0]['friends_count'] . "',\n\t\t\t`twitter_description` = '" . $SQL->e($res[0]['description']) . "'\n\t\t\t where id=" . $r['id']);