Archive for January, 2009

Facebook + Dating = Win!

January 20th, 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!

Facebook Ads

Quickly creating post arrays for CURL

January 20th, 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.

1
2
3
4
5
6
7
8
9
10
11
12
13
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.

1
2
3
$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:

1
2
3
4
5
6
$postData['log'] = 'exosus';
$postData['pwd'] = 'sexytime';
$postData['rememberme'] = 'forever';
$postData['testcookie'] = '1';
$postData['redirect_to'] = 'http://wordpress.com/';
$postData['submit'] = 'Login';