Tuesday, 24 February 2015

How to share Embed youtube video on facebook From my website

How to share Embed youtube video on facebook From my website

Following are two steps


1. Get video-code from YouTube URL video URL
Suppose you have following youtube video.

https://www.youtube.com/watch?v=adn45xIFa4g

Now get the video-Code i.e adn45xIFa4g from YouTube URL.

2. Update the following meta tags (fill Video Code)
<meta property="og:title" content="How to share Embed youtube video on facebook From my website"  />
<meta property="og:description" content="How to share Embed youtube video on facebook From my website" />
<meta property="og:url" content="http://www.web-technology-experts-notes.in/2015/02/how-to-share-embed-youtube-video-on-facebook-from-my-website.html" />
<meta property="og:type" content="video" >
<meta property="og:image" content="http://i1.ytimg.com/vi/adn45xIFa4g/maxresdefault.jpg" />
<meta property="og:video" content="http://www.youtube.com/e/adn45xIFa4g" />
<meta property="og:video:height" content="268" />
<meta property="og:video:width" content="480" />

<!-- DON'T FORGET TO ADD META TAGS FOR HTTPS -->
<meta property="og:url:secure_url" content="http://www.web-technology-experts-notes.in/2015/02/how-to-share-embed-youtube-video-on-facebook-from-my-website.html" >
<meta property="og:image:secure_url" content="https://i1.ytimg.com/vi/adn45xIFa4g/maxresdefault.jpg" />
<meta property="og:video:secure_url" content="https://www.youtube.com/e/adn45xIFa4g" >
<!-- DON'T FORGET TO ADD META TAGS FOR HTTPS -->

3. Paste the above meta tags before the closing of head tag (</head>)




Thursday, 19 February 2015

How to send Attachment in Email in zend framework1 - Send PDF File

How to send Attachment in Email in zend framework1 - Send PDF File

Sending an attachment in Email is very easy in zend framework. Attachmnet can be PDF file, image file, text and excel file etc. For Different type of attachment have different types of mime type. For example pdf mime type is "application/pdf" where gif image mime type is "image/gif".

In E-commerce website, when an order is placed by customer on the online website. Customer get the order detail in form of Order PDF File, So that he can keep offline record too.


Following code snippet is for How to attach a PDF file in Email using Zend Framework.
 
  /** Must fill Following detail * */
        $emailTo = 'receipts@no-spam.ws';
        $emailToName = 'receipts Name';
        /** Must fill Following detail * */
        $emailSubject = 'This is subject';
        $emailBody = 'This is HTML Email Body';
        $fromEmail = 'fromemail@no-spam.ws';
        try {
            $config = array(
                'ssl' => 'tls',
                'auth' => 'login',
                'username' => 'SMTP_USERNAME',
                'password' => 'SMTP_PASSWORD'
            );
            $transport = new Zend_Mail_Transport_Smtp('SMTP_HOST', $config);

            $mail = new Zend_Mail();
            $mail->setBodyHtml($emailBody);
            $mail->setFrom($fromEmail);
            $mail->addTo($emailTo, $emailToName);
            $mail->setSubject($emailSubject);
            
            /**PDF Add Attachment **/
            $attachment = new Zend_Mime_Part('path to pdf file');
            $attachment->type        = 'application/pdf';
            $attachment->disposition = Zend_Mime::DISPOSITION_ATTACHMENT;
            $attachment->encoding = Zend_Mime::ENCODING_BASE64;
            $attachment->filename    = 'order.pdf';
            $mail->addAttachment($attachment);
            /** Add Attachment **/            

            if ($mail->send($transport)) {
                echo 'Sent successfully';
            } else {
                echo 'unable to send email';
            }
        } catch (Exception $e) {
            echo $e->getMessage();
        }



Different Types of Attachment