Q:

email current url on if else condition with no send button

)
i want the smallest possible script to send current URL via email without a send button
but as a result of an if { } else {} condition..   
ideas anyone?
ok.. i have gotten so far.. got a script on one end reciving and mailing
the desired data to the desired email.. then i need a way to send the current
page URL without a send button but as a result of an if (!notsomething) {} else{ send!!}  
so i have this so far AND it works!! but i am getting partial URL
instead of "http://www.example.com/subfile.php" i am getting just "/subfile.php"
$websiteurl = $_SERVER['REQUEST_URI'];
$curl_connection =  curl_init('http://www.sagive.co.il/downloads/wordpress/linkRemovedNotification.php');

//set options
curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($curl_connection, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, 1);

//set data to be posted
curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $websiteurl);

//perform our request
$result = curl_exec($curl_connection);

//show information regarding the request
print_r(curl_getinfo($curl_connection));
echo curl_errno($curl_connection) . '-' . curl_error($curl_connection);
//close the connection
curl_close($curl_connection);

For some weird reason it wont send when i use:
$websiteurl = $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];

.
SO.. thats the last problem.. ideas anyone?

A:

Ok! solved it :) - thanks for your help and your time.
here is the code i used and it works (Collected from sites across the web)
//extract data from the post
$currentw = $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
$currentth = SpaceJunkie;

//set POST variables
$url = 'http://www.example.com';
$fields = array(
                        'siteurl'=>urlencode($currentwebsite),
                        'themename'=>urlencode($currentheme),
                );

//url-ify the data for the POST
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string,'&');

//open connection
$ch = curl_init();

//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);

//execute post
$result = curl_exec($ch);

//close connection
curl_close($ch);

