Hi Everyone,
I am very new to PHP, and I need some help with a project I am working on. So basically what happens is the QR code is generated and a short URL is generated as well for the QR Code, and what I need is the short URL that is generated to be sent to my email address. Here is what the code looks like:
<?php
class Url_shortner_class {
function shorten_url($criteria=array()) {
$url = $criteria['url'];
$type = $criteria['type']; //google
if($type=='google') {
return $this->shorten_url_with_google(array('url'=>$url));
}
}
/*
Google shortner service
*/
function shorten_url_with_google($criteria=array()) {
$url = $criteria['url'];
$api_url = 'https://www.googleapis.com/urlshortener/v1/url';
if($GLOBALS['google_api_key']!='') $api_url .= '?key='.$GLOBALS['google_api_key'];
$result = getDataFromUrl($api_url, json_encode(array("longUrl"=>$url)), 'json');
$result = json_decode($result,true);
$data['longUrl'] = $url;
$data['shortUrl'] = $result['id'];
return $data;
}
}
?>
All I need is to add a section that will send the URL to my email address, but I am unsure on how to write the code to do that. Thank you!