Ever wanted to see all the different redirect urls a particular link redirects through with PHP/CURL? Now you can with this nifty little piece of code (the only thing I haven’t written yet is a way to handle redirects that don’t contain the hostname). Anyway, with that said, check this out:
$url = “http://www.somesiteyouknowuseslocationredirect.com”;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
$data = curl_exec($ch);
$curl_info = curl_getinfo($ch);
$redirect_count = $curl_info['redirect_count'];
$header_size = $curl_info['header_size'];
$header = substr($data, 0, $header_size);
$redirecturls = array();
if($redirect_count>0){
preg_match_all(”/location:(.*?)\n/is”, $header, $locations);
foreach($locations[1] as $location){;
$redirecturls[] = trim($location);
}
}
Posted in My Terrible Coding, Nifty Little Tricks.
This was a conversation about a sketchy ad I put together with a hot chick on it.
(11:41:16 AM) Brett: yowzas
(11:41:19 AM) Brett: i’d hit it
(11:41:50 AM) Me: would u click it
(11:42:05 AM) Brett: well i’m not a retard, so no
(11:42:15 AM) Brett: but luckily movies like dance flick and scary movie make it to #1 box office
I think that was pretty well said.
Posted in Random Rants.
I posted in the past about scraping forms for use when you need to make a post using CURL along with a little bit of code. I’ve recently moved on to using DOM and this little function I wrote below. I finally got fed up with sites adding new hidden fields and having to write preg_matches for unique variables that a lot of sites are stuffing into their forms these days to prevent spammers and/or track sessions.
/*
If you don’t have the plugin already in you need the php-xml plugin. Depending on your setup ‘yum install php-xml’ should do the trick.
$html is the html code of the site you’d get using file_get_contents, CURL or whatever.
$form_number is the number of the form you want - 1. It’s usually ok just to leave this at 0 but sometimes sites have more than 1 form on the page so you have to specify.
The postData array is returned and ready for posting in CURL, all you need to do is find the few fields you actually need to specify and update those fields within the postData array. It’s usually as easy as $postData['email'] = myemail@emailme.com;
Last note, since this is fairly new, it only works on inputs and textareas. I haven’t ran across needing it for anything else yet, but if you post a comment about something it’s missing I’ll add it for ya.
*/
function getInputs($html, $form_number = 0){
$dom = new DOMDocument();
@$dom->loadHTML($html); //@ is there cuz this will throw up a bunch of errors if the html code isn’t perfect
$forms = $dom->getElementsByTagName(”form”);
$form = $forms->item($form_number);
$inputs = $form->getElementsByTagName(”input”);
foreach($inputs as $input){
$postData[$input->getAttribute('name')] = $input->getAttribute(’value’);
}
$inputs = $form->getElementsByTagName(”textarea”);
foreach($inputs as $input){
$postData[$input->getAttribute('name')] = $input->nodeValue;
}
return $postData;
}
Posted in My Terrible Coding.
By admin
February 12, 2009
I’m gunna go cry now. Thx. Seriously though, I normally don’t like posting content that is completely useless on my blog but I laughed pretty hard when I saw this for an IQ offer.

Posted in Random Rants.
By admin
February 9, 2009
Basically Gmail strips all .’s out of an email address when it receives the email. So you can essentially make 100s of different email addresses out of only 1 gmail address by simply taking your current email and adding .’s to it. For example: exosusrocks@gmail.com and making it e.xosusrocks@gmail.com, e.x.osusrocks@gmail.com, so on and so forth will all still go to exosusrocks@gmail.com. It comes in handy when say you want to create a new user on a forum but don’t want to have to create a new email address.
Posted in Nifty Little Tricks.
By admin
February 5, 2009
Dating is still holding up, but grants with Obama and soldiers on ‘em are where it’s at!

Oh and here are the nice images you can copy and paste that facebook is allowing. They nicely misrepresent Obama and our soldiers. But don’t try to post any deceiving text adcopy that would be bad!

Posted in Effin Facebook.
By admin
February 4, 2009
Grendel-Scan is a security scanner which you can run against your website to check for vulnerablities. It was demonstrated/announced at DefCon last year and I never really got around to reviewing it/recommending it. Anyway, it’s a pretty cool little program that you can use to pentest your website/scripts for vulnerabilities. Just a simple test on prosper202 without logging into it prior revealed the following:
Directories were found supporting content listing.The vulnerable directories(s) are listed below:
http://www.mydom.com:80/202-img/
http://www.mydom.com:80/202-img/flags/
http://www.mydom.com:80/icons/
http://www.mydom.com:80/icons/small/
Although not that intriguing since these are hardly major vulnerabilities, you can play around w/ this program against various other types of free web applications out there along with testing your own.
Posted in Security.
By admin
February 1, 2009
Facebook has become raped by dating ads in the past few weeks. If you aren’t jumping on the bandwagon you need to get on it!

Posted in Effin Facebook.
By admin
January 20, 2009
One thing I’ve spent a lot of time over is breaking up post variables for use in CURL and posting to forms. Sure you have the option of using an array or just replacing a few variables in a string with CURL but sometimes forms can get crazy with the amount of unique variables they have. Missing a simple unique variable or spelling it wrong can result in hours of wasted time trying to figure out why something won’t work. So I created this lil snippet of code to basically help break down a post string into a nice postData array for use in CURL.
function formInfo($text){
$forms = split(”&”, $text);
foreach($forms as &$form){
$values = split(”=”, $form);
$check = urldecode($values[1]);
echo ‘$postData[\'' . urldecode($values[0]) . ‘\’]’ . ” = ‘$check’;\n”;
}
}
So for a random example use, I did it on wordpress’s login system.
$text = “log=exosus&pwd=sexytime&rememberme=forever&testcookie=1&redirect_to=http%3A%2F%2Fwordpress.com%2F&submit=Login”;
formInfo($text);
which produces the result:
$postData['log'] = ‘exosus’;
$postData['pwd'] = ’sexytime’;
$postData['rememberme'] = ‘forever’;
$postData['testcookie'] = ‘1′;
$postData['redirect_to'] = ‘http://wordpress.com/’;
$postData['submit'] = ‘Login’;
Posted in My Terrible Coding.
By admin
January 20, 2009
Looks like I’ll be going to Affiliate Summit West from January 11th to the 14th. If you want to meet up, throw me a message on AIM at : YRM (yes 3 characters)
Posted in Conferences.
By admin
December 29, 2008