Changeset 194644
- Timestamp:
- 01/16/2010 11:48:00 PM (16 years ago)
- Location:
- googl-generator/trunk
- Files:
-
- 2 edited
-
googl-generator.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
googl-generator/trunk/googl-generator.php
r194567 r194644 4 4 Plugin URI: http://www.dolcebita.com/wordpress/googl-generator/ 5 5 Description: Returns short URL based on Goo.gl using Matthew Flaschen web service. 6 Version: 0. 16 Version: 0.2 7 7 Author: Marcos Esperon 8 8 Author URI: http://www.dolcebita.com/ … … 26 26 27 27 function googl_generator($long_url) { 28 $output = ''; 28 29 $output = ''; 30 29 31 if (extension_loaded("curl")) { 32 30 33 $curl = curl_init("http://ggl-shortener.appspot.com/?url=" . rawurlencode($long_url)); 31 34 curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); 32 35 $response_text = curl_exec($curl); 33 36 if($response_text) { 34 $json_response = json_decode($response_text); 35 /*if($error = ($json_response->error_message)) 36 throw new Exception("Gateway returned error: " . $error);*/ 37 $json_response = json_decode($response_text); 37 38 } 38 39 $output = $json_response->short_url; 40 41 } else { 42 43 $url = htmlentities($long_url, ENT_QUOTES); 44 $obj = json_decode(file_get_contents('http://ggl-shortener.appspot.com/?url=' . urlencode($url))); 45 $output = $obj->{'short_url'}; 46 39 47 } 48 40 49 echo $output; 50 41 51 } 42 52 -
googl-generator/trunk/readme.txt
r194571 r194644 6 6 Stable tag: 0.1 7 7 8 Returns short URL based on Goo.gl using Matthew Flaschen web service. cURL PHP extension must be enabled in your server.8 Returns short URL based on Goo.gl using Matthew Flaschen web service. 9 9 10 10 == Description == … … 32 32 == Changelog == 33 33 34 = 0.2 = 35 * Alternative method without cURL extension. 36 34 37 = 0.1 = 35 38 * Initial release.
Note: See TracChangeset
for help on using the changeset viewer.