<?php
/**
* Retrieve public ip with PHP cURL
*/
$curl_handle=curl_init();
curl_setopt($curl_handle,CURLOPT_URL,'http://whatismyip.org/');
curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,2);
$public_ip = curl_exec($curl_handle);
curl_close($curl_handle);
//echo "my ip address is ".$public_ip;
/**
* Let's say we have the slide located
* at http://localhost/papers/bigtable-osdi06.ppt
* The link to view it from google viewer will be
*/
echo 'http://docs.google.com/viewer?url='.urlencode("http://$public_ip/papers/bigtable-osdi06.ppt");
?>
I retrieve the url with the cURL trick because there isn't a PHP method to let you know your public ip and this way works both in windows or linux as long as http://whatismyip.org/ is up and running.
Edit:
Ofcource your web-server has to be accessible from the internet!