Quick script to generate tons of unique usernames (for automated blogposts or whatever other clever uses you can come up with..)
As long as you don't want to use it with Twitter
Quick script to generate tons of unique usernames (for automated blogposts or whatever other clever uses you can come up with..)
Post the code or if it's lot, post a direct download link (zipped, of course). I don't care too much about you dropping a link, just post the resource here not elsewhere.Can we link to our own blog posts? It's not like we'd be doing it for link juice since WF redirects and I don't update enough to care about getting readers
I did a good writeup on passing variables in wordpress here: Cool Tip: Pass Variables From Page To Page in Wordpress - LargeAffiliate.com
<?php include_once('MadlibSpinner.php'); ?>
echo Madlib::spin("{two|four} eggs");
echo Madlib::spin("{two|four} eggs","www.domain.tld/mypage.php");
echo Madlib::spin("{two|four} eggs","www.domain.tld/mypage.php","two");
echo Madlib::spin("{two|four} eggs","www.domain.tld/mypage.php","one|two|three");
echo Madlib::spin("{two|three|four} eggs","",array("one","two","three"));
For all those who spin articles or posts (eg with bestspinner), here is a class of mine I use in autoblogs to reuse my content often:
http://www.automated-marketing-system.com/madlib/madlib.php.zip
Example for usage:
AWARE ADULT CONTENT:
General text (left side, bottom) is spinned, girls description is from csv.
Discover Axelle Parker: Golden eyes @VirtualGirl2HD.com
Watch Aria Giovanni: Vampire killer @VirtualGirl2HD.com
...
(for wf members use only, please don't contribute)
Usage:
$outputstring = Madlib::spin(string $text [, string $salt] [,mixed $keys])
Description:
This library can be used to spin text containing madlibs (like '{one|{two|2|a pair}|three}') by selecting words thru random, a optional salt (for example a url or domain) and prefered keywords (optional).
Installation:
Just copy and extract this file into your webspace and include it at the top of your php-files:
Parameters:PHP:<?php include_once('MadlibSpinner.php'); ?>
string $text The text that should be spinned, nested spintax/madlibs are possible
string $salt [optional] If given, the text would be spinned every time the same way. If not, text will be spinned by random each time. Good for autosites, when the url is the salt, the page would always be the same.
mixed $keys [optional] Can be a string with one keyword, a madlib with keywords separeted by '|' or an array with several keywords. If given keywords will be prefered.
Return Values:
Returns the spun text, with madlibs replaced
Examples:
Will output "two eggs" or "four eggs"PHP:echo Madlib::spin("{two|four} eggs");
Will ouput every time: "four eggs" cause of the given saltPHP:echo Madlib::spin("{two|four} eggs","www.domain.tld/mypage.php");
Will ouput every time: "two eggs" cause of the given keywordPHP:echo Madlib::spin("{two|four} eggs","www.domain.tld/mypage.php","two");
Will ouput every time: "two eggs" cause of 'two' is included in the given keyword madlibPHP:echo Madlib::spin("{two|four} eggs","www.domain.tld/mypage.php","one|two|three");
Will ouput: "two eggs" or "three eggs" randomly cause no salt is given and "two" and "three" are in the keys arrayPHP:echo Madlib::spin("{two|three|four} eggs","",array("one","two","three"));
For all those who spin articles or posts...
For all those who spin articles or posts (eg with bestspinner), here is a class of mine I use in autoblogs to reuse my content often:
<?php
function name_spinner ($query, $num_suggestions = 20) {
// Configure these 3 variables
$key = 'xxxxx-ttttt-aaaaa-33333-44444';
$partner = 'yourpartnername';
if(count($_REQUEST[domainlevel])<1)
{
echo "you must select at least one TLDS";
exit;
}
foreach($_REQUEST[domainlevel] as $tld)
{
$tlds[]=$tld;
}
// Construct the url to load
$url = '/api.xml?';
$url .= 'partner=' . $partner;
$url .= '&key=' . $key;
// $url .= '&customer_ip=' . getenv('REMOTE_ADDR');
$url .= '&customer_ip=' . $_SERVER['REMOTE_ADDR'];
$url .= '&appname=name_spinner';
$url .= '&version=4';
$url .= '&ext='. implode('|', $tlds); // The TLDs should be seperated by pipes
$url .= '&q='. urlencode($query);
$url .= '&rows=' . $num_suggestions;
$url .= '&adult='.$_REQUEST[aduldomains];// 'auto', 'no', or 'yes'
$url .= '&more='; // '' or 80 for more results
$toReturn = array('suggestions' => array(), 'error' => '');
$host = 'engine.whoisapi.com';
$ip = gethostbyname($host);
if (!$ip || $host == $ip) {
$toReturn['error'] = 'Unable to resolve host';
} else {
// Download this page
$fp = @fsockopen($host, 80, $errno, $errstr, 10);
if (!$fp) {
$toReturn['error'] = $errstr;
} else {
$header = "GET $url HTTP/1.0\n" .
"Host: $host\n" .
"User-Agent: Name Spinner SDK\n" .
"Connection: close\r\n\r\n";
fwrite($fp, $header);
$res = '';
$start_time = time();
while (!feof($fp)) {
$res .= fread($fp, 100000); // 100kb
$diff = time() - $start_time;
if ($diff > 10) {// Timeout at 10 seconds
$toReturn['error'] = 'Read timed out';
return $toReturn;
}
if (!feof($fp)) {
usleep(100);// 0.01 seconds
}
}
fclose($fp);
// Strip the headers
$res = substr($res, strpos($res, '<?xml'));
$parser = xml_parser_create();
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, false);
xml_parse_into_struct($parser, $res, $xmlvals, $xmlindex);
// if the API didn't return any data because an error occurred
if (!isset($xmlindex['e_n'])) {
$toReturn['error'] = 'The API returned an error. View the API XML to resolve the error. ';
} else {
// Always run htmlentities() on data being retrieved from an outside sources
// so foreign HTML/Javascript cannot invade your site
$toReturn['time'] = htmlentities($xmlvals[$xmlindex['querytime'][0]]['value']);
$toReturn['query'] = htmlentities($xmlvals[$xmlindex['e_n'][0]]['value']);
$toReturn['status'] = htmlentities($xmlvals[$xmlindex['e_s'][0]]['value']);
$tlds = htmlentities( strtolower( $xmlvals[$xmlindex['extn'][0]]['value']));
$toReturn['tlds'] = explode('|', $tlds);
foreach($xmlindex['id'] as $keyv => $i) {
$toReturn['suggestions'][$keyv] = array();
$toReturn['suggestions'][$keyv]['id'] = htmlentities($xmlvals[$i]['value']);
}
foreach($xmlindex['n'] as $keyv => $i) {
$toReturn['suggestions'][$keyv]['suggestion'] = htmlentities($xmlvals[$i]['value']);
}
foreach($xmlindex['s'] as $keyv => $i) {
$toReturn['suggestions'][$keyv]['status'] = htmlentities($xmlvals[$i]['value']);
}
}
xml_parser_free($parser);
}
}
return $toReturn;
}
?>
<?php echo '<?xml version="1.0" encoding="iso-8859-1"?' . ">\n"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Name Spinner SDK Example</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
table.results {
border: solid 1px #aaa;
border-bottom: none;
}
table.results td {
border-bottom: solid 1px #aaa;
}
</style>
</head>
<body>
<h2>Domain Search</h2>
<form action="<?php echo $PHP_SELF; ?>" method="post">
<p>
Search Name Spinner:
<?php
$v = '';
if (isset($_REQUEST['q'])) {
$v = htmlentities( stripslashes($_REQUEST['q']) );
}
?>
<input size="30" type="text" name="q" value="<?php echo $v; ?>" />
<label>
<br />
Adult:
<select name="adultdomains" id="adultdomains">
<option value="yes">yes</option>
<option value="no">no</option>
</select>
<br />
.com:
<input name="domainlevel[]" type="checkbox" id="domainlevel[]" value="com" checked="checked" />
<br />
.net:
<input name="domainlevel[]" type="checkbox" id="domainlevel[]" value="net" />
<br />
.org:
<input name="domainlevel[]" type="checkbox" id="domainlevel[]" value="org" />
<br />
.info:
<input name="domainlevel[]" type="checkbox" id="domainlevel[]" value="info" />
<br />
.biz:
<input name="domainlevel[]" type="checkbox" id="domainlevel[]" value="biz" />
<br />
.us:
<input name="domainlevel[]" type="checkbox" id="domainlevel[]" value="us" />
<br />
<br />
</label>
<input type="submit" value="Submit"/>
</p>
</form>
<?php
if (isset($_REQUEST['q'])) {
// Define a function to print the status for each TLD that was returned
function formatStatus ($status, $tlds) {
foreach ($tlds as $key => $valud) {
// If it is available
if ($status{$key} == 'q') {
echo '<td>O</td>';
} else {
echo '<td>X</td>';
}
}
}
?>
<h3>Results</h3>
<?php
// Send the api our query and get back the results
$results = name_spinner($_REQUEST['q'], 30);
if ($results['error'] == '') {
?>
<p>
<strong>Query Time:</strong> <?php echo $results['time']; ?> sec.
</p>
<table class="results" cellpadding="3" cellspacing="0">
<tr>
<td style="width: 1.5em;"></td>
<td style="width: 13em;"><strong>Suggestion</strong></td>
<?php
// Print all the TLDs
foreach ($results['tlds'] as $tld) {
?>
<td><strong><?php echo strtoupper($tld) ?></strong></td>
<?
}
?>
</tr>
<tr>
<td><strong>>></strong></td>
<td><?php echo $results['query'] ?></td>
<?php
formatStatus($results['status'], $results['tlds']);
?>
</tr>
<?php
foreach ($results['suggestions'] as $suggestion) {
?>
<tr>
<td><strong><?php echo $suggestion['id'] ?>.</strong></td>
<td><?php echo $suggestion['suggestion'] ?></td>
<?php
formatStatus($suggestion['status'], $results['tlds']);
?>
</tr>
<?php
}
?>
</table>
<?php
} else {
?>
<p>
An error has occurred and we could not generate any suggestions
for you at this time. Please come back later.
</p>
<?php
}
}
?>
</body>
</html>
<?PHP
$states = array("AL" =>"Alaska",
"CA" => "California",
"CO" => "Colorado",
"TX" => "Texas",
"AL" => "ALABAMA",
"AK" => "ALASKA",
"AZ" => "ARIZONA",
"AR" => "ARKANSAS",
"CA" => "CALIFORNIA",
"CO" => "COLORADO",
"CT" => "CONNECTICUT",
"DE" => "DELAWARE",
"DC" => "DISTRICT OF COLUMBIA",
"FL" => "FLORIDA",
"GA" => "GEORGIA",
"HI" => "HAWAII",
"ID" => "IDAHO",
"IL" => "ILLINOIS",
"IN" => "INDIANA",
"IA" => "IOWA",
"KS" => "KANSAS",
"KY" => "KENTUCKY",
"LA" => "LOUISIANA",
"ME" => "MAINE",
"MD" => "MARYLAND",
"MA" => "MASSACHUSETTS",
"MI" => "MICHIGAN",
"MN" => "MINNESOTA",
"MS" => "MISSISSIPPI",
"MO" => "MISSOURI",
"MT" => "MONTANA",
"NE" => "NEBRASKA",
"NV" => "NEVADA",
"NH" => "NEW HAMPSHIRE",
"NJ" => "NEW JERSEY",
"NM" => "NEW MEXICO",
"NY" => "NEW YORK",
"NC" => "NORTH CAROLINA",
"ND" => "NORTH DAKOTA",
"OH" => "OHIO",
"OK" => "OKLAHOMA",
"OR" => "OREGON",
"PA" => "PENNSYLVANIA",
"RI" => "RHODE ISLAND",
"SC" => "SOUTH CAROLINA",
"SD" => "SOUTH DAKOTA",
"TN" => "TENNESSEE",
"TX" => "TEXAS",
"UT" => "UTAH",
"VT" => "VERMONT",
"VA" => "VIRGINIA",
"WA" => "WASHINGTON",
"WV" => "WEST VIRGINIA",
"WI" => "WISCONSIN",
"WY" => "WYOMING ",
);
$link = mysql_connect('localhost', 'wpusername', 'wppassword');
if (!$link)
{
die('Could not connect: ' . mysql_error());
}
else
{
echo 'Connected successfully';
}
$db_selected = mysql_select_db('wpdatabasename', $link);
if (!$db_selected)
{
die ('Can\'t use mysql db : ' . mysql_error());
}
$post_author = "1"; //ID from wordpress of the author
foreach($states as $stateshort => $statelong)
{
$post_content = "$statelong Blah bla Blah Blah bla BlahBlah bla BlahBlah bla BlahBlah bla Blah
Blah bla BlahBlah bla BlahBlah bla BlahBlah bla BlahBlah bla Blah
Blah bla BlahBlah bla BlahBlah bla BlahBlah bla BlahBlah bla BlahBlah bla Blah
Blah bla BlahBlah bla Blah $statelong Blah bla BlahBlah bla BlahBlah bla Blah $statelong.
yBlah bla BlahBlah bla BlahBlah bla BlahBlah bla BlahBlah bla BlahBlah bla BlahBlah bla Blahl.";
$post_title = "Blah Blah ".$statelong;
$post_name = "blah-bla-bllla-".strtolower($statelong);
$sql = "
INSERT INTO
wp_posts
(
post_author,
post_date,
post_date_gmt,
post_content,
post_title,
post_status,
comment_status,
ping_status,
post_name,
post_modified,
post_modified_gmt,
post_type
)
VALUES
(
'$post_author',
NOW(),
NOW(),
'$post_content',
'$post_title',
'publish',
'open',
'open',
'$post_name',
NOW(),
NOW(),
'page'
)
";
echo "<PRE>";
print_r($sql);
echo "</PRE>";
$result = mysql_query($sql);
if (!$result)
{
die('Invalid query: ' . mysql_error());
}
else
{
$postid = mysql_insert_id();
$sql = "INSERT INTO
wp_postmeta
(
post_id,
meta_key,
meta_value
)
VALUES
(
'$postid',
'_wp_page_template',
'default'
)
";
$result = mysql_query($sql);
echo "<BR>
created page for ".$statelong;
}
}?>
WHAT THE SHIT?Thanks for these, sfast! I'll be using them both for sure.
I am greatly thankful for such a nice and informative post. Everyone should share such important information like you did. Thanks
I will rape you in your fucking mouth.
Like this one???still if you are unable to rectify means go head with you tube videos
<?php
#List your xml files here. Add more xml-files if you like, but be sure to list added variables to $loadxml
$productxml1 = 'some-merchant.xml';
$productxml2 = 'some-other-merchant.xml';
$productxml3 = 'another-merchant.xml';
$productxml4 = 'for-the-good-times-merchant.xml';
# This loads all the xml-data and checks if an error occured, then foreach'es through all of them.
$loadxml = array($productxml1,$productxml2,$productxml3,$productxml4);
foreach($loadxml as $awesome){
$xml = simplexml_load_file($awesome);
if(!$xml=simplexml_load_file($awesome)){
trigger_error('Some error occured',E_USER_ERROR);
}
foreach($xml as $product){
# The awesome starts here: Use any xml-node (here Category) and search for a keyword. Outputs only items in the xml with the given keyword. Could be replaces by a variable though ...
if(strstr($product->Category,'your-keyword')){
# node named deepLink carries full affialte link, node named 'name' is the title. use as you wish!
echo '<a href="'.$product->deepLink.'" title="'.$product->name.'" rel="nofollow">'.$product->name.'</a>';
}
}
}
?>