Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //Usually this would be in a seperate "require('config.php');" for organization, but meh...
- $db['host'] = "whateverhost";
- $db['name'] = "whatevername";
- $db['user'] = "whateveruser";
- $db['pass'] = "whateverpass";
- $mysqli = new mysqli($db['host'], $db['user'], $db['pass'], $db['name']);
- if ($mysqli->connect_error) {
- die('Connect Error (' . $mysqli->connect_errno . ') '
- . $mysqli->connect_error);
- /**
- * Usage:
- * getDomain();
- * returns "example.com" ... "othersite.com" ... etc and insterts directly to a database
- *
- */
- function getDomain()
- {
- $content = file_get_contents('http://mailinator.com/randomdomain.jsp');
- $pattern = '^[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}$';
- preg_match($pattern, $content, $match);
- $domain = $match[1];
- $query = "SELECT FROM `tablename` WHERE domain='$domain'";
- $results = $mysqli->query($query);
- while($results) //This is me trying to figure out how to do a thing
- {
- $content = file_get_contents('http://mailinator.com/randomdomain.jsp');
- preg_match($pattern, $content, $match);
- $domain = $match[1];
- $query = "SELECT FROM `tablename` WHERE domain='$domain'";
- $results = $mysqli->query($query);
- }
- $query = "INSERT INTO `tablename` (domain) VALUES ('$domain')" //This needs to be modified
- $results = $mysqli->query($query);
- $results->free();
- $mysqli->close();
- return $domain;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement