Archive for January, 2008

Pass $_post Variables Without Forms

by on Jan.11, 2008, under PHP Code


Ever wanted to send variables to another script without clogging up the URI? Well the following is a function which allows you to do just that:


To use this function just call it đŸ˜‰

 $something = sendPost($URL_of_the_file_you_want_to_pass_the_variables_to, $an_array_containing_the_variables_you_wish_to_send)

Note: The array needs to be made up in the following way:

$context = array(
	'post_variable1' => 'post_value1',
	'post_variable2' => 'post_value2',
	'post_variable3' => 'post_value3'


function sendPost($url, $context)
	$context = array_change_key_case($context, CASE_LOWER);
	$contextSize = sizeof($context);		
	$contextKeys = array_keys($context);
	$data = "";
	foreach ($contextKeys as $key)
		$amp = "&";
		if (next($contextKeys) === FALSE) { $amp = ""; }
		$data .= urlencode($key)."=".urlencode($context[$key]).$amp;

	list($host,$url) = explode('/',$url,2);
	$sock = fsockopen($host,80,$errno,$errstr,1);
	if (!$sock) { die("$errstr ($errno) in ".__FILE__." (".__LINE__.")\n"); }
	$http_request = "POST /".$url." HTTP/1.1\r\n";
	$http_request .= "Host: ".$host."\r\n";
	$http_request .= "Content-type: application/x-www-form-urlencoded\r\n";
	$http_request .= "Content-length: " . strlen($data) . "\r\n";
	$http_request .= "Accept: */*\r\n";
	$http_request .= "\r\n";
	$http_request .= "$data\r\n";
	$http_request .= "\r\n";
	$response_headers = array();
	while ($str = trim(fgets($sock)))
	$errors = true;
	$errorMsg = "";
	foreach($response_headers as $response_header){
		if($response_header == 'HTTP/1.1 200 OK'){
			$errors = false;
		}elseif($response_header == 'X-UFU: OK'){
			$errors = false;
	if (!$errors)
		return true;
		return false;

Enjoy and please free to leave a comment if you use this code

VN:F [1.9.22_1171]
Rating: 5.0/5 (2 votes cast)
2 Comments more...

Online Directories – Customer Street

by on Jan.10, 2008, under Web

Well as some of you may have read I recently started working for a company based in Lancaster, Customer Street who deal with online directories and portals. Since starting there my main responsibility has been carrying out upgrades to the online directories in order to improve both functionality and usability. These can be found at:

Feel free to leave comments about what you think about them.

According to a few online ranking systems, UFindUs is the second largest online directory behind and is constantly on the rise.

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
Leave a Comment more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!