tag:blogger.com,1999:blog-34023438476159258022024-03-13T08:28:25.850-07:00Code Labskiranhttp://www.blogger.com/profile/02602195715866242058noreply@blogger.comBlogger113125tag:blogger.com,1999:blog-3402343847615925802.post-81481944458204058852023-08-25T00:07:00.000-07:002023-08-25T00:07:25.528-07:00Character encoding to UTF-8<p> </p><p>header('Content-Type: text/html; charset=utf-8');</p><p>ini_set("default_charset", "UTF-8");</p><p>mb_internal_encoding("UTF-8");</p><p><br /></p><p>function clean($string) {</p><p> $string = str_replace(' ', '-', $string); // Replaces all spaces with hyphens.</p><p> return preg_replace('/[^A-Za-z0-9\-]/', '', $string); // Removes special chars.</p><p> }</p><p><br /></p><p> function clean4($string) {</p><p> //$string = mb_convert_encoding($string, 'UTF-16LE', 'UTF-8');</p><p> //$string = iconv(mb_detect_encoding($string, mb_detect_order(), true), "UTF-8", $string);</p><p> $string = trim(ltrim(ltrim($string,":"),"-"));</p><p> //return preg_replace('/[^A-Za-z0-9\-]/', ' ', trim($string));</p><p> return trim($string);</p><p> }</p><p><br /></p><p>function isUTF8($string) {</p><p> return (utf8_encode(utf8_decode($string)) == $string);</p><p>}</p><p>function replace_unicode_escape_sequence($match) {</p><p><span style="white-space: normal;"><span style="white-space: pre;"> </span>return mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE');</span></p><p>}</p><p><br /></p><p>$string = iconv(mb_detect_encoding($string, mb_detect_order(), true), "UTF-8", $string);</p><p><br /></p><p>htmlspecialchars_decode(htmlspecialchars(get_the_title($postID), ENT_QUOTES, 'UTF-8'));</p>kirankoyandehttp://www.blogger.com/profile/00177235145215576396noreply@blogger.com0tag:blogger.com,1999:blog-3402343847615925802.post-69003447327473565822022-07-05T03:26:00.007-07:002022-07-05T03:30:34.740-07:00Simple Encrypt and Decrypt using PHP and aes-256<p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAB20tE_dFQ1Vxmro2MQTgm0dhSJJN7YzZZjYNXUvDsWl3PGFPk_YPHAxnp0FCS6X_JaMKnmYVAmsNdbSOHbB_aj0v3kRQmDgy34OH6NZhyAeL4-eJz0UVBRe9zjmA4EqkUieZ46aqdpKIreIMy4gfUWBc66hq1zQmPMSXyxzK0ZHnANmvpJU2TmCX/s259/php7-transparent.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="259" data-original-width="184" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAB20tE_dFQ1Vxmro2MQTgm0dhSJJN7YzZZjYNXUvDsWl3PGFPk_YPHAxnp0FCS6X_JaMKnmYVAmsNdbSOHbB_aj0v3kRQmDgy34OH6NZhyAeL4-eJz0UVBRe9zjmA4EqkUieZ46aqdpKIreIMy4gfUWBc66hq1zQmPMSXyxzK0ZHnANmvpJU2TmCX/w142-h200/php7-transparent.png" width="142" /></a></div><br /> <p></p><p>$key ="<SOME_KEY_HERE>";</p><p>$iv='<SOME_KEY_HERE>';</p><p><br /></p><p>function encryptFile($encKey, $encIV, $instr, $outPath) {</p><p> $sourceFile=$instr;</p><p> $key = base64_decode($encKey);</p><p> $iv = base64_decode($encIV);</p><p> $encrypter = 'aes-256-cbc';</p><p> $encryptedString = openssl_encrypt($sourceFile, $encrypter, $key, 0, $iv);</p><p> return $encryptedString;</p><p>}</p><p><br /></p><p>function decryptFile($encKey, $encIV, $instr, $outPath) {</p><p> $encryptedString=$instr;</p><p> $key = base64_decode($encKey);</p><p> $iv = base64_decode($encIV);</p><p> $encrypter = 'aes-256-cbc';</p><p> $decrypted = openssl_decrypt($encryptedString, $encrypter, $key, 0, $iv);</p><p> return $decrypted;</p><p>}</p><p><br /></p><p>$encstr = encryptFile ($key, $iv,"<TEXT TO ENCRYPT>","");</p><p>echo $encstr; //encrypted text here</p><p><br /></p><p>$Dencstr = decryptFile ($key, $iv,$encstr,"");</p><p>echo "<br>";</p><p>echo $Dencstr;</p>kiranhttp://www.blogger.com/profile/02602195715866242058noreply@blogger.com0tag:blogger.com,1999:blog-3402343847615925802.post-2176791475098256512022-02-01T04:22:00.009-08:002022-02-01T04:28:26.732-08:00Send SMS using Infobip API | PHP | Curl call<p></p><div class="separator" style="clear: both; text-align: center;"><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEhkzGFU66Pnpme0e0tuV3N16VAajD6aV09Gnaq8v4JJIzbDyLOZYaaWXq2F4kd3IkKiFWnXIYLgtKVgTyz9yMs42UO7rs7BEW0p9mSGB2YHyNLNp-HLvvMW_U9FAjgX_nzekrFgS4hVHPXg5nbXnG0J_ziwUkP-GriIEt6XHmjpPHhy1uiRnqITrZbO=s230" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="230" data-original-width="230" height="230" src="https://blogger.googleusercontent.com/img/a/AVvXsEhkzGFU66Pnpme0e0tuV3N16VAajD6aV09Gnaq8v4JJIzbDyLOZYaaWXq2F4kd3IkKiFWnXIYLgtKVgTyz9yMs42UO7rs7BEW0p9mSGB2YHyNLNp-HLvvMW_U9FAjgX_nzekrFgS4hVHPXg5nbXnG0J_ziwUkP-GriIEt6XHmjpPHhy1uiRnqITrZbO" width="230" /></a></div><div class="separator" style="clear: both; text-align: center;"><br /></div></div><p></p><div>Recently I used Infobip SMS gateway for my client. It is Wocommerce website. so we are sending SMS communication for various Wocommerce events.</div><div>Hope this sample curl code will help you.</div><div><br /></div><div><b>Requirement for SMS send using API.</b></div><div>1) Infobip account and Authentication Key</div><div>2) Approved SMS templates</div><div>3) Approved DLT</div><div>4) Approved Sender Name</div><div><br /></div><div><b>PHP Code as follows.</b></div><div><br /></div><div>//call a function to send SMS</div><div>sendSMSNotification($to, $name, $smsType, $var1, $var2);</div><div><br /></div><div><div>function sendSMSNotification($to, $name, $smsType, $var1, $var2){</div><div><br /></div><div> $messageId = <UNIQUE_MESSAGE_ID>;</div><div> $notifyUrl = "<NOTIFY_URL>";</div><div><br /></div><div> $dltArray = ['DLT_ID_1','DLT_ID_2','DLT_ID_3','DLT_ID_4','DLT_ID_5','DLT_ID_6','DLT_ID_7','DLT_ID_8','DLT_ID_9'];</div><div><br /></div><div>//List of events for sending SMS communications.</div><div> $smsTypeArray = ['shipped','delivered','feedback','abandonmentcart','cancelled','outfordelivery','orderconfirmed','passwordresetotp','registrationotp'];</div><div> </div><div>//List of approved SMS templates</div><div> $msgTemplatesArray = [</div><div> "Hi {$name}. Your order has shipped. Keep track of your delivery here: {$var1}{$var2}",</div><div> "Hi {$name}, Your order from us has been delivered. You can view your order here: {$var1}{$var2}",</div><div> "Hi {$name}, It's been a week since your order was delivered. Would you take one minute to tell us about your experience? You can leave a review here: {$var1}{$var2}",</div><div> "Hi {$name}, You left some items in your cart! We wanted to make sure you had the chance to get what you needed. Shop now: {$var1}{$var2}",</div><div> "Hi {$name}. Heads up - Your order from {$var1} has been cancelled now. Please check status here {$var2}",</div><div> "Hi {$name}. Heads up - Your order from {$var1} is out for delivery and will arrive soon",</div><div> "Thanks for shopping with us! Your order is confirmed and will be shipped shortly. Check your status here: <WEBSITE_URL>",</div><div> "To reset your password, validate with this OTP, {$var1}. <CLIENT_NAME>",</div><div> "Thank you for registering on <CLIENT_NAME> website. Your OTP is {$var1}. Validate within 15 minutes. Do not share OTP with any one. <WEBSITE_URL>"</div><div> ];</div><div><br /></div><div> $key = array_search($smsType,$smsTypeArray);</div><div><br /></div><div> $destination = array("messageId" => $messageId, "to" => $to);</div><div><br /></div><div> $message = array(</div><div> "from" => '<SENDER_ID>',</div><div> "indiaDltContentTemplateId" => $dltArray[$key],</div><div> "indiaDltPrincipalEntityId" => '<ENTITY_ID_Number>',</div><div> "destinations" => array($destination),</div><div> "text" => $msgTemplatesArray[$key],</div><div> "notifyUrl" => $notifyUrl,</div><div> "notifyContentType" => 'application/json',</div><div> "callbackData" => '');</div><div><br /></div><div> $postData = array("messages" => array($message));</div><div> $postDataJson = json_encode($postData);</div><div><br /></div><div> $ch = curl_init();</div><div> curl_setopt($ch, CURLOPT_URL, '<INFOBIP_BASE_URL>/sms/2/text/advanced');</div><div> curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);</div><div> curl_setopt($ch, CURLOPT_POST, 1);</div><div> curl_setopt($ch, CURLOPT_POSTFIELDS, $postDataJson);</div><div> $headers = array();</div><div> $headers[] = 'Authorization: App <INFOBIP_KEY>';</div><div> $headers[] = 'Content-Type: application/json';</div><div> $headers[] = 'Accept: application/json';</div><div> curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);</div><div><br /></div><div> $result = curl_exec($ch);</div><div> if (curl_errno($ch)) {</div><div> echo 'Error:' . curl_error($ch);</div><div> return 0;</div><div> }</div><div> curl_close($ch);</div><div><br /></div><div> //return $result;</div><div> return 1;</div><div><br /></div><div>}</div></div><div><br /></div><div><br /></div>kiranhttp://www.blogger.com/profile/02602195715866242058noreply@blogger.com0tag:blogger.com,1999:blog-3402343847615925802.post-74564073602192988082022-02-01T03:53:00.003-08:002022-02-01T03:53:46.663-08:00Send SMS using msg91 API | PHP | Curl call<div style="text-align: left;"><div style="text-align: left;"><br /></div><div style="text-align: left;"><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEhg_NkDMDMTrfLzPMlzsxqrhNY62M003MNsgatHcE3XbnGsmsokcYBolOVpvTDYwTYKJcqdHGJ-ITp03z3J00ysGhb6Oo_X_96Hus70ktqKUISFYpsNvnDwKj9UuKBxA0rWZUrJ4NrIS1H55nttCfztuzxgax1q1o3j1hMyWJ48zFCZHUA610xJr-J9" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="450" data-original-width="450" height="240" src="https://blogger.googleusercontent.com/img/a/AVvXsEhg_NkDMDMTrfLzPMlzsxqrhNY62M003MNsgatHcE3XbnGsmsokcYBolOVpvTDYwTYKJcqdHGJ-ITp03z3J00ysGhb6Oo_X_96Hus70ktqKUISFYpsNvnDwKj9UuKBxA0rWZUrJ4NrIS1H55nttCfztuzxgax1q1o3j1hMyWJ48zFCZHUA610xJr-J9" width="240" /></a></div><br /><br /></div><div style="text-align: left;">Msg91 is a my preferred SMS gateway. I used in most of the Apps and websites.</div><div style="text-align: left;"><br /></div><div style="text-align: left;">Requirement for SMS send using API.</div><div style="text-align: left;">1) MSG91 account and Authentication Key</div><div style="text-align: left;">2) Approved SMS templates</div><div style="text-align: left;">3) Approved DLT</div><div style="text-align: left;">4) Approved Sender Name</div><div style="text-align: left;"><br /></div><div style="text-align: left;"><b>PHP Code as follows.</b></div><div style="text-align: left;"><br /></div><div style="text-align: left;">//below is the post-fields </div><div style="text-align: left;"><div>//json_string = "{ \"sender\": \"<SENDER_NAME>\", \"route\": \"4\", \"country\": \"91\", \"sms\": [ { \"message\": \"Hi, Your OTP is $num for verification on test.\", \"to\": [ \"$phone\" ] } ] }",</div><div><br /></div><div>$postDataJson = json_encode($postData);</div></div><div style="text-align: left;"><br /></div>$authentication_key = "<MSG91_Authntication_Key>"; </div><div style="text-align: left;"><br /></div><div style="text-align: left;">//phone number with country code prefix</div><div style="text-align: left;">//here 91 in country code for India<br />$phone = '910000000000';</div><div style="text-align: left;"><br /></div><div style="text-align: left;"><div>$postData = array(</div><div> "sender" => "<SENDER_NAME>", </div><div> "route" => "4", </div><div> "country" => "91", </div><div> "sms" => array(</div><div> "message" => "Hi, Your OTP is {$otp} for verification on {$var2}.",</div><div> "to" => [$phone]</div><div> )</div><div>);</div></div><div style="text-align: left;"><br /></div><div style="text-align: left;">$curl = curl_init();<br /> curl_setopt_array($curl, array(<br /> CURLOPT_URL => "https://api.msg91.com/api/v2/sendsms",<br /> CURLOPT_RETURNTRANSFER => true,<br /> CURLOPT_ENCODING => "",<br /> CURLOPT_MAXREDIRS => 10,<br /> CURLOPT_TIMEOUT => 30,<br /> CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,<br /> CURLOPT_CUSTOMREQUEST => "POST",<br /> CURLOPT_POSTFIELDS => $postDataJson,<br /> CURLOPT_SSL_VERIFYHOST => 0,<br /> CURLOPT_SSL_VERIFYPEER => 0,<br /> CURLOPT_HTTPHEADER => array(<br /> "authkey: $authentication_key",<br /> "content-type: application/json"<br /> ),<br /> ));<br /> $response = curl_exec($curl);<br /> $err = curl_error($curl);<br /> curl_close($curl);</div>kiranhttp://www.blogger.com/profile/02602195715866242058noreply@blogger.com0tag:blogger.com,1999:blog-3402343847615925802.post-53219984821407718362019-04-24T05:55:00.001-07:002019-04-24T23:06:56.224-07:00Most Useful common Regex collection<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhjVd25dUgr3F4WhhueNJTL6HjemiIPo8QQDfrHJwn0SNMb7Jg7dxc53geP3qK8mqpR6_9WZMYg7cBkbmy3wPoNc6XKFoTwXkC3x0nMCCZij9zLrXiMjP-MvyHS9yhUeM9WEWDPQpVZp8/s1600/php7-transparent.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" data-original-height="259" data-original-width="184" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhjVd25dUgr3F4WhhueNJTL6HjemiIPo8QQDfrHJwn0SNMb7Jg7dxc53geP3qK8mqpR6_9WZMYg7cBkbmy3wPoNc6XKFoTwXkC3x0nMCCZij9zLrXiMjP-MvyHS9yhUeM9WEWDPQpVZp8/s200/php7-transparent.png" width="142" /></a></div>
<br />
The most commonly used and useful regexes collection.<br />
<br />
1) Trim trailing spaces<br />
=> ^[\s]*(.*?)[\s]*$<br />
<br />
2) Matches any valid HTML tag. (Not for nested tags)<br />
=> <([a-z]+)([^<]+)*(?:>(.*)<\/\1>|\s+\/>)<br />
<br />
3) Check for Hexadecimal value<br />
=> \B#(?:[a-fA-F0–9]{6}|[a-fA-F0–9]{3})\b<br />
<br />
4) Validate email ID<br />
=> \b[\w.!#$%&’*+\/=?^`{|}~-]+@[\w-]+(?:\.[\w-]+)*\b<br />
<br />
5) Username validation<br />
Minimum length of 3, maximum length of 16, composed by letters, numbers or dashes.<br />
=> /^[a-z0-9_-]{3,16}$/<br />
<br />
6) Password checking<br />
Moderate password - Minimum length of 6, at least one uppercase letter, at least one lowercase letter, at least one number, at least one special character<br />
=> (?=^.{6,}$)((?=.*\w)(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[|!"$%&\/\(\)\?\^\'\\\+\-\*]))^.*<br />
<br />
Strong password - Should have 1 lowercase letter, 1 uppercase letter, 1 number, 1 special character and be at least 8 characters long<br />
=> /(?=(.*[0-9]))(?=.*[\!@#$%^&*()\\[\]{}\-_+=~`|:;"'<>,./?])(?=.*[a-z])(?=(.*[A-Z]))(?=(.*)).{8,}/<br />
<br />
7) URL (http, https or ftp) checking<br />
If you want to use capturing groups to get scheme, path, etc. (or add user-info, host, port…)<br />
=> ^(((https?|ftp):\/\/)?([\w\-\.])+(\.)([\w]){2,4}([\w\/+=%&_\.~?\-]*))*$<br />
<br />
8) IPv4 address validation<br />
=> \b(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\b<br />
<br />
9) Alpha-numeric, literals, digits, lowercase, uppercase chars only<br />
\w //alpha-numeric only<br />
[a-zA-Z] //literals only<br />
\d //digits only<br />
[a-z] //lowercase literal only<br />
[A-Z] //uppercase literal only<br />
<br />
10) find an image with a specific source<br />
enter image name to search img tags with specific image<br />
=> /<img.*src=".*IMAGE-NAME-HERE".*?>/<br />
eg:- preg_replace('/<img.*src=".*'.basename($img_path).'".*?>/', 'REPLACE-WITH', $string);<br />
- here i am replacing image tags where image name matches.<br />
<br />
11) find and replace all image tags<br />
=> /<img[^>]+\>/i<br />
<br />
12) remove specific html tags<br />
remove any html tag, mention html tag without brackets.<br />
=> /<\\/?HTML-TAG-HERE(.|\\s)*?>/<br />
<br />
13) get image source from <img tag><br />
=> /^<\s*img[^>]+src\s*=\s*(["'])(.*?)\1[^>]*>$/<br />
<br />
14) remove junk characters from string<br />
=> '/[^(\x20-\x7F)\x0A\x0D]*/'<br />
eg:- preg_replace('/[^(\x20-\x7F)\x0A\x0D]*/','', $string);<br />
<br />
15) remove white spaces from string<br />
=> /\s+/<br />
eg:- preg_replace('/\s+/', '-', $string);<br />
- here i am replacing spaces with '-'<br />
<br />
16) remove non-alphanumeric character from string<br />
=> /[^A-Za-z0-9\-]/<br />
eg:- preg_replace('/[^A-Za-z0-9\-]/', '-', $galleryURL)<br />
- here i am replacing any non alphanumeric character with '-'<br />
<br />
17) remove a specific attribute from tags.<br />
=> / attribute=("|\')(.*?)("|\')/<br />
eg:- preg_replace('/ style=("|\')(.*?)("|\')/','',$string);<br />
here i am replacing style attribute from html tags.<br />
<br />
18) remove <script> tag from string<br />
=> #<script(.*?)>(.*?)</script>#is<br />
eg:- preg_replace('#<script(.*?)>(.*?)</script>#is', '', $string);<br />
- here i am removing script tags from html string<br />
<br />
19) replace shortcode (useful for wordpress)<br />
=> /\[SHORTCODE_HERE id="([^"]*)"]/<br />
<br />
20) Javascript Handlers<br />
Inline JS handler => /\bon\w+=\S+(?=.*>)/<br />
Inline JS handler with element => /(?:<[^>]+\s)(on\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|[>"']))+.)["']?/<br />
<br />
more to coming soon...</div>
kiranhttp://www.blogger.com/profile/02602195715866242058noreply@blogger.com0tag:blogger.com,1999:blog-3402343847615925802.post-75170456729497087562019-03-02T03:25:00.005-08:002019-03-04T02:59:58.509-08:00Create and Send Campaign Using MooSend API<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjLK-TTVYqFOdTFQX4QqnQJAkEGAPuiDM_ckn9qT_tpNUinB6xwiGhGqgsymbiWF_gZipT9B6mS4lD2ZGRzYj9vKX9AxtqjgyksYGxlLtjIBRhMqYtMsSGj4ebUeb1HlsCBXv7J63KXA4/s1600/moosend-logo.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="400" data-original-width="400" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjLK-TTVYqFOdTFQX4QqnQJAkEGAPuiDM_ckn9qT_tpNUinB6xwiGhGqgsymbiWF_gZipT9B6mS4lD2ZGRzYj9vKX9AxtqjgyksYGxlLtjIBRhMqYtMsSGj4ebUeb1HlsCBXv7J63KXA4/s200/moosend-logo.png" width="200" /></a></div>
<?php<br />
<br />
<span style="white-space: pre;"> </span>$apikey = "<MOOSEND-API-KEY-HERE>";<br />
<span style="white-space: pre;"> </span>$listID = "<MOOSEND-LIST-ID-HERE>";<br />
<span style="white-space: pre;"> </span>$ep = "https://api.moosend.com/v3/";<br />
<br />
<span style="white-space: pre;"> </span>$ch = curl_init();<br />
<br />
<span style="white-space: pre;"> </span>$url = $ep."campaigns/create.json?Format=json&apikey=".$apikey;<br />
<br />
<span style="white-space: pre;"> </span>$bulkPostFields = array (<br />
<span style="white-space: pre;"> </span> 'Name' => '<CAMPAIGN-NAME-HERE>',<br />
<span style="white-space: pre;"> </span> 'Subject' => '<CAMPAIGN-SUBJECT-HERE>',<br />
<span style="white-space: pre;"> </span> 'SenderEmail' => '<SENDER-EMAIL-ID-HERE>',<br />
<span style="white-space: pre;"> </span> 'ReplyToEmail' => '<SENDER-EMAIL-ID-HERE>',<br />
<span style="white-space: pre;"> </span> 'ConfirmationToEmail' => '<SENDER-EMAIL-ID-HERE>',<br />
<span style="white-space: pre;"> </span> 'MailingLists' => [<br />
<span style="white-space: pre;"> </span>array (<br />
<span style="white-space: pre;"> </span>'MailingListID' => "<MOOSEND-LIST-ID-HERE>",<br />
<span style="white-space: pre;"> </span>'SegmentID' => "<MOOSEND-SEGMENT-ID-HERE>"<br />
<span style="white-space: pre;"> </span>),<br />
<span style="white-space: pre;"> </span>],<br />
<span style="white-space: pre;"> </span>'WebLocation' => "PATH-TO-HTML-EMAILER",<br />
);<br />
<br />
<span style="white-space: pre;"> </span>curl_setopt($ch, CURLOPT_URL, $url);<br />
<span style="white-space: pre;"> </span>curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);<br />
<span style="white-space: pre;"> </span>curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($bulkPostFields));<br />
<span style="white-space: pre;"> </span>curl_setopt($ch, CURLOPT_POST, 1);<br />
<br />
<span style="white-space: pre;"> </span>$headers = array();<br />
<span style="white-space: pre;"> </span>$headers[] = "Content-Type: application/json";<br />
<span style="white-space: pre;"> </span>$headers[] = "Accept: application/json";<br />
<span style="white-space: pre;"> </span>curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);<br />
<br />
<span style="white-space: pre;"> </span>$result = curl_exec($ch);<br />
<span style="white-space: pre;"> </span>if (curl_errno($ch)) {<br />
<span style="white-space: pre;"> </span>echo 'Error:' . curl_error($ch);<br />
<span style="white-space: pre;"> </span>}else{<br />
<span style="white-space: pre;"> </span>$res = json_decode($result);<br />
<span style="white-space: pre;"> </span>$campaignID = $res->Context;<br />
<span style="white-space: pre;"> </span>}<br />
<span style="white-space: pre;"> </span>curl_close ($ch);<br />
<br />
<span style="white-space: pre;"> </span>//campaign send here<br />
<span style="white-space: pre;"> </span>$ch = curl_init();<br />
<br />
<span style="white-space: pre;"> </span>curl_setopt($ch, CURLOPT_URL, $ep."campaigns/".$campaignID."/send.json?apikey=".$apikey);<br />
<span style="white-space: pre;"> </span>curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);<br />
<span style="white-space: pre;"> </span>curl_setopt($ch, CURLOPT_POST, 1);<br />
<br />
<span style="white-space: pre;"> </span>$headers = array();<br />
<span style="white-space: pre;"> </span>$headers[] = "Content-Type: application/json";<br />
<span style="white-space: pre;"> </span>$headers[] = "Accept: application/json";<br />
<span style="white-space: pre;"> </span>$headers[] = "Content-Length: 0";<br />
<span style="white-space: pre;"> </span>curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);<br />
<br />
<span style="white-space: pre;"> </span>$result = curl_exec($ch);<br />
<span style="white-space: pre;"> </span>if (curl_errno($ch)) {<br />
<span style="white-space: pre;"> </span>echo 'Error:' . curl_error($ch);<br />
<span style="white-space: pre;"> </span>}else{<br />
<span style="white-space: pre;"> </span>echo $result;<br />
<span style="white-space: pre;"> </span>}<br />
<span style="white-space: pre;"> </span>curl_close ($ch);<br />
<br />
<span style="white-space: pre;"> </span>?> </div>
kiranhttp://www.blogger.com/profile/02602195715866242058noreply@blogger.com0tag:blogger.com,1999:blog-3402343847615925802.post-2545044374836364042019-03-02T03:25:00.002-08:002019-03-04T03:02:13.257-08:00Create and Send Campaign Using Active Campaign API<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDhe3bD-4ql2MfuzFmWpiT1ULM-54okaJqV6gN6m2mybuYceN_wiT_NMvlotVr-H_E_LB5WAxc6rVKpgnFQN1eLrEX0OxZv2QSCGYitLCzxVh35_4soRQn5VwA4EqPhOLTdFlflQl1ZZM/s1600/activecampaign-logo.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="840" data-original-width="1600" height="105" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDhe3bD-4ql2MfuzFmWpiT1ULM-54okaJqV6gN6m2mybuYceN_wiT_NMvlotVr-H_E_LB5WAxc6rVKpgnFQN1eLrEX0OxZv2QSCGYitLCzxVh35_4soRQn5VwA4EqPhOLTdFlflQl1ZZM/s200/activecampaign-logo.png" width="200" /></a></div>
<br />
Coming Soon..</div>
kiranhttp://www.blogger.com/profile/02602195715866242058noreply@blogger.com0tag:blogger.com,1999:blog-3402343847615925802.post-59805006003587570322019-03-02T03:24:00.005-08:002019-03-04T03:00:13.075-08:00Create and Send Campaign Using SendGrid API<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiupvz0CFfQR9JqX7O3YM9M2wU1-6M6CEPSgw_zjPLbAFgp9xTfgi1E3qbX47BVORNy-S4M6l0lnbdssRquLy2BbITdmXm3eouR7nJYT_jlFozuqQuyq41P9h9a8-EHUed-QPNXit84kNY/s1600/sendgrid-logo.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="630" data-original-width="1200" height="168" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiupvz0CFfQR9JqX7O3YM9M2wU1-6M6CEPSgw_zjPLbAFgp9xTfgi1E3qbX47BVORNy-S4M6l0lnbdssRquLy2BbITdmXm3eouR7nJYT_jlFozuqQuyq41P9h9a8-EHUed-QPNXit84kNY/s320/sendgrid-logo.png" width="320" /></a></div>
<?php<br />
<br />
$apiKey = "<SENDGRID-API-KEY-HERE>";<br />
<br />
$html_content = file_get_contents($emailerpath);<br />
$html_content = str_replace("*|UNSUB|*", "[unsubscribe]", $html_content); //code to add unsubscribe link<br />
<br />
$titleText = 'AD Daily - ' . date("Y-m-d");<br />
$postFields = array('title' => '<CAMPAIGN-NAME-HERE>', 'subject' => '<CAMPAIGN-SUBJECT-HERE>', "sender_id" => "<SENDER-ID-HERE>",<br />
"list_ids" => array("<LIST-ID-HERE>"),<br />
"categories" => array("<CAMPAIGN-CATEGORY>"),<br />
"html_content" => $html_content,<br />
"plain_content" => $mail_subject . ' <a href="[unsubscribe]" style="text-decoration:none;" target="_blank"><span style="color: #000000;">Unsubscribe</span></a>',<br />
"suppression_group_id" => "<UNSUBSCRIBE-GROUP-ID-HERE>",<br />
);<br />
$aa = json_encode($postFields);<br />
<br />
//create a campaign using sendGrid<br />
$curl = curl_init();<br />
curl_setopt_array($curl, array(<br />
CURLOPT_URL => "https://api.sendgrid.com/v3/campaigns",<br />
CURLOPT_RETURNTRANSFER => true,<br />
CURLOPT_ENCODING => "",<br />
CURLOPT_MAXREDIRS => 10,<br />
CURLOPT_TIMEOUT => 30,<br />
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,<br />
CURLOPT_CUSTOMREQUEST => "POST",<br />
CURLOPT_POSTFIELDS => $aa,<br />
CURLOPT_HTTPHEADER => array(<br />
"authorization: Bearer " . $apiKey . "",<br />
"content-type: application/json"<br />
),<br />
));<br />
$response = json_decode(curl_exec($curl));<br />
$err = curl_error($curl);<br />
curl_close($curl);<br />
<br />
if ($err) {<br />
echo "<br/>cURL Error #:" . $err;<br />
} else {<br />
$campaignID = $response->id;<br />
}<br />
<br />
//send a campaign using sendGrid<br />
if (isset($campaignID) && $campaignID != "") {<br />
echo " campaignID ==> " . $campaignID;<br />
$curl = curl_init();<br />
<br />
curl_setopt_array($curl, array(<br />
CURLOPT_URL => "https://api.sendgrid.com/v3/campaigns/" . $campaignID . "/schedules/now",<br />
CURLOPT_RETURNTRANSFER => true,<br />
CURLOPT_ENCODING => "",<br />
CURLOPT_MAXREDIRS => 10,<br />
CURLOPT_TIMEOUT => 30,<br />
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,<br />
CURLOPT_CUSTOMREQUEST => "POST",<br />
CURLOPT_POSTFIELDS => "null",<br />
CURLOPT_HTTPHEADER => array(<br />
"authorization: Bearer " . $apiKey . "",<br />
"content-type: application/json"<br />
),<br />
));<br />
<br />
$response = curl_exec($curl);<br />
$err = curl_error($curl);<br />
<br />
curl_close($curl);<br />
<br />
if ($err) {<br />
echo "<br/>cURL Error #:" . $err;<br />
} else {<br />
echo '<br/>Operation completed without any errors <br/>';<br />
echo $response;<br />
}<br />
}<br />
<br />
?></div>
kiranhttp://www.blogger.com/profile/02602195715866242058noreply@blogger.com0tag:blogger.com,1999:blog-3402343847615925802.post-33139039944498051552019-03-02T03:24:00.001-08:002019-03-04T03:00:29.065-08:00Create and Send Campaign Using Mailchimp API<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiADgGRqyrEdVAEz2UpH_xfFi0aZ8sKPijfkY2lKbvwz2aKyaBE-i5LEdcItLvB_rQOZ3MCXiiEe5AaSOem9vOxexMtpk-pWLxRVMNxs6NAefDFaSas0fhyphenhyphenTIPfPoeqUDab2OHDOW6bU3c/s1600/mailchimp-logo.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="500" data-original-width="714" height="140" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiADgGRqyrEdVAEz2UpH_xfFi0aZ8sKPijfkY2lKbvwz2aKyaBE-i5LEdcItLvB_rQOZ3MCXiiEe5AaSOem9vOxexMtpk-pWLxRVMNxs6NAefDFaSas0fhyphenhyphenTIPfPoeqUDab2OHDOW6bU3c/s200/mailchimp-logo.png" width="200" /></a></div>
<span id="goog_1491884874"></span><span id="goog_1491884875"></span><br />
<?php<br />
<br />
//Include MailChimp API version 3 Class Library<br />
include('mcv3/src/MailChimp.php');<br />
<br />
use \DrewM\MailChimp\MailChimp;<br />
$MailChimp = new MailChimp('<MAILCHIMP-API-KEY-HERE>');<br />
<br />
<span style="white-space: pre;"> </span>//create campaign at Mailchimp<br />
$result = $MailChimp->post('campaigns', array(<br />
"type" => 'regular',<br />
"recipients" => array(<br />
"list_id" => "<LIST-ID-HERE>",<br />
"segment_opts" => array(<br />
"match" => "any",<br />
"conditions" => array(<br />
array("field" => "interests-<INTEREST-GROUP-ID-HERE>", "op" => "interestcontains", "value" => ["<INTEREST-ID-HERE>"])<br />
),<br />
)<br />
),<br />
'settings' => array(<br />
'subject_line' => '<CAMPAIGN-SUBJECT-HERE>',<br />
'title' => '<CAMPAIGN-NAME-HERE>',<br />
'from_name' => '<FROM-NAME-HERE>',<br />
'reply_to' => '<FROM-EMAIL-ID-HERE>',<br />
'auto_footer' => false<br />
),<br />
'content' => array('url' => $emailerpath),<br />
));<br />
$campaign_id = $result['id'];<br />
<br />
//sleep for Sometime<br />
sleep(20);<br />
<span style="white-space: pre;"> </span><br />
<span style="white-space: pre;"> </span>//put content to campaign<br />
$contentx = json_encode($MailChimp->put('/campaigns/' . $campaign_id . '/content', array('url' => $emailerpath)<br />
));<br />
<br />
//sleep for Sometime<br />
sleep(20);<br />
<span style="white-space: pre;"> </span><br />
<span style="white-space: pre;"> </span>//send email to list<br />
echo json_encode($MailChimp->post('/campaigns/' . $campaign_id . '/actions/send'));<br />
<br />
?></div>
kiranhttp://www.blogger.com/profile/02602195715866242058noreply@blogger.com0tag:blogger.com,1999:blog-3402343847615925802.post-17180139017841674542018-05-07T05:30:00.000-07:002018-05-07T05:42:24.150-07:00Remove empty items from a multidimensional array in PHP<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: justify;">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhjVd25dUgr3F4WhhueNJTL6HjemiIPo8QQDfrHJwn0SNMb7Jg7dxc53geP3qK8mqpR6_9WZMYg7cBkbmy3wPoNc6XKFoTwXkC3x0nMCCZij9zLrXiMjP-MvyHS9yhUeM9WEWDPQpVZp8/s1600/php7-transparent.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="259" data-original-width="184" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhjVd25dUgr3F4WhhueNJTL6HjemiIPo8QQDfrHJwn0SNMb7Jg7dxc53geP3qK8mqpR6_9WZMYg7cBkbmy3wPoNc6XKFoTwXkC3x0nMCCZij9zLrXiMjP-MvyHS9yhUeM9WEWDPQpVZp8/s200/php7-transparent.png" width="141" /></a></div>
<span style="color: #222222; font-family: "verdana" , sans-serif;"><br /></span>
<span style="color: #222222; font-family: "verdana" , sans-serif;"><br /></span>
<span style="color: #222222; font-family: "verdana" , sans-serif;">The following function removes empty items from a (multidimensional) array and returns the resulting array. Please notice that the use of recursion is required because of the array can be of an unknown number of levels, that is, arrays inside the cells of the array, and so on.</span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;"><br /></span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;">function array_non_empty_items($input) {</span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;"> // If it is an element, then just return it</span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;"> if (!is_array($input)) {</span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;"> return $input;</span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;"> }</span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;"> $non_empty_items = array();</span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;"> foreach ($input as $key => $value) {</span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;"> // Ignore empty cells</span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;"> if($value) {</span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;"> // Use recursion to evaluate cells </span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;"> $non_empty_items[$key] = array_non_empty_items($value);</span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;"> }</span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;"> }</span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;"> // Finally return the array without empty items</span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;"> return $non_empty_items;</span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;"> }</span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;"><br /></span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;"><br /></span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;">By example, if we pass the following array to the function:</span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;"><br /></span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;"> $MasterArray = array(</span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;"> ‘country’ => ‘CO’,</span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;"> ‘region’ => ”,</span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;"> ‘city’ => ”,</span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;"> ‘features’ => array(</span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;"> ‘home’ => array(‘garden’, ‘bedrooms’=>3),</span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;"> ‘beach’ => array(‘no_more_than’=>30, ‘yachts_rental’),</span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;"> ‘supermarkets’ => ”,</span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;"> ‘discotheque’ => ”</span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;"> )</span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;"> );</span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;"><br /></span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;">Then we will obtain an array without empty items, like this:</span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;"><br /></span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;">$MasterArray = array(</span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;"> ‘country’ => ‘CO’,</span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;"> ‘ features’ => array(</span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;"> ‘home’ => array(‘garden’, ‘ bedrooms’=>3),</span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;"> ‘ beach’ => array(‘no_more_than’=>30, ‘ yachts_rental’)</span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;"> )</span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;">);</span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;"><br /></span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;"><br /></span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;"><br /></span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;"><br /></span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;"><br /></span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;"><br /></span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;"><br /></span></div>
<div style="text-align: justify;">
<span style="color: #222222; font-family: "verdana" , sans-serif;"><br /></span></div>
<div style="text-align: justify;">
<br /></div>
</div>
kiranhttp://www.blogger.com/profile/02602195715866242058noreply@blogger.com1tag:blogger.com,1999:blog-3402343847615925802.post-30555932629836153382017-04-19T22:53:00.001-07:002017-04-19T22:55:08.982-07:00HTML Share Buttons<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhsFUxZdbme0m1VWJ60U1Wltb9h5PUojl7g4Hsn7j_HH-G3xems_ide38GfQddqmRA8_dzcAGEBhzYeTBbgZQ1TXGdHk5vRHbk3FfBpyyrAPOhqdx_ADxAtF4zNzxxvX9VVzNTUkSOq-68/s1600/1013-icons-38%255B1%255D.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="174" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhsFUxZdbme0m1VWJ60U1Wltb9h5PUojl7g4Hsn7j_HH-G3xems_ide38GfQddqmRA8_dzcAGEBhzYeTBbgZQ1TXGdHk5vRHbk3FfBpyyrAPOhqdx_ADxAtF4zNzxxvX9VVzNTUkSOq-68/s320/1013-icons-38%255B1%255D.jpg" width="320" /></a></div>
<br />
These simple social Share Button Codes will help you alot.<br />
<br />
<div id="share-buttons"><br />
<br />
<!-- Buffer --><br />
<a href="https://bufferapp.com/add?url=https://sourcecode-kk.blogspot.in&amp;text=Simple Share Buttons" target="_blank"><br />
<img src="http://sourcecode-kk.blogspot.inimages/somacro/buffer.png" alt="Buffer" /><br />
</a><br />
<br />
<!-- Digg --><br />
<a href="http://www.digg.com/submit?url=https://sourcecode-kk.blogspot.in" target="_blank"><br />
<img src="http://sourcecode-kk.blogspot.inimages/somacro/diggit.png" alt="Digg" /><br />
</a><br />
<br />
<!-- Email --><br />
<a href="mailto:?Subject=Simple Share Buttons&amp;Body=I%20saw%20this%20and%20thought%20of%20you!%20 https://sourcecode-kk.blogspot.in"><br />
<img src="http://sourcecode-kk.blogspot.inimages/somacro/email.png" alt="Email" /><br />
</a><br />
<br />
<!-- Facebook --><br />
<a href="http://www.facebook.com/sharer.php?u=https://sourcecode-kk.blogspot.in" target="_blank"><br />
<img src="http://sourcecode-kk.blogspot.inimages/somacro/facebook.png" alt="Facebook" /><br />
</a><br />
<br />
<!-- Google+ --><br />
<a href="https://plus.google.com/share?url=https://sourcecode-kk.blogspot.in" target="_blank"><br />
<img src="http://sourcecode-kk.blogspot.inimages/somacro/google.png" alt="Google" /><br />
</a><br />
<br />
<!-- LinkedIn --><br />
<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=https://sourcecode-kk.blogspot.in" target="_blank"><br />
<img src="http://sourcecode-kk.blogspot.inimages/somacro/linkedin.png" alt="LinkedIn" /><br />
</a><br />
<br />
<!-- Pinterest --><br />
<a href="javascript:void((function()%7Bvar%20e=document.createElement('script');e.setAttribute('type','text/javascript');e.setAttribute('charset','UTF-8');e.setAttribute('src','http://assets.pinterest.com/js/pinmarklet.js?r='+Math.random()*99999999);document.body.appendChild(e)%7D)());"><br />
<img src="http://sourcecode-kk.blogspot.inimages/somacro/pinterest.png" alt="Pinterest" /><br />
</a><br />
<br />
<!-- Print --><br />
<a href="javascript:;" onclick="window.print()"><br />
<img src="http://sourcecode-kk.blogspot.inimages/somacro/print.png" alt="Print" /><br />
</a><br />
<br />
<!-- Reddit --><br />
<a href="http://reddit.com/submit?url=https://sourcecode-kk.blogspot.in&amp;title=Simple Share Buttons" target="_blank"><br />
<img src="http://sourcecode-kk.blogspot.inimages/somacro/reddit.png" alt="Reddit" /><br />
</a><br />
<br />
<!-- StumbleUpon--><br />
<a href="http://www.stumbleupon.com/submit?url=https://sourcecode-kk.blogspot.in&amp;title=Simple Share Buttons" target="_blank"><br />
<img src="http://sourcecode-kk.blogspot.inimages/somacro/stumbleupon.png" alt="StumbleUpon" /><br />
</a><br />
<br />
<!-- Tumblr--><br />
<a href="http://www.tumblr.com/share/link?url=https://sourcecode-kk.blogspot.in&amp;title=Simple Share Buttons" target="_blank"><br />
<img src="http://sourcecode-kk.blogspot.inimages/somacro/tumblr.png" alt="Tumblr" /><br />
</a><br />
<br />
<!-- Twitter --><br />
<a href="https://twitter.com/share?url=https://sourcecode-kk.blogspot.in&amp;text=Simple%20Share%20Buttons&amp;hashtags=sourcecode-kk" target="_blank"><br />
<img src="http://sourcecode-kk.blogspot.inimages/somacro/twitter.png" alt="Twitter" /><br />
</a><br />
<br />
<!-- VK --><br />
<a href="http://vkontakte.ru/share.php?url=https://sourcecode-kk.blogspot.in" target="_blank"><br />
<img src="http://sourcecode-kk.blogspot.inimages/somacro/vk.png" alt="VK" /><br />
</a><br />
<br />
<!-- Yummly --><br />
<a href="http://www.yummly.com/urb/verify?url=https://sourcecode-kk.blogspot.in&amp;title=Simple Share Buttons" target="_blank"><br />
<img src="http://sourcecode-kk.blogspot.inimages/somacro/yummly.png" alt="Yummly" /><br />
</a><br />
<br />
</div><br />
<br /></div>
kiranhttp://www.blogger.com/profile/02602195715866242058noreply@blogger.com0tag:blogger.com,1999:blog-3402343847615925802.post-17868676848814803552017-04-19T22:24:00.002-07:002017-04-19T22:55:26.194-07:00Social Meta Tags for Twitter, Google+, Facebook and More<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZ8JVlsFhMXisLXPKjGvR89oj5cqHqOPpMIqoPs4UHHN4RjIcuymy1D3Rs0hHCzUSMl5WycIiXXdukWtBXWBe2HWrnbhXtKbwrH7lyxic8H4CUitqYmlBiZR6_nsibdqPAg4_uA3XvtOg/s1600/social_icons.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="174" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZ8JVlsFhMXisLXPKjGvR89oj5cqHqOPpMIqoPs4UHHN4RjIcuymy1D3Rs0hHCzUSMl5WycIiXXdukWtBXWBe2HWrnbhXtKbwrH7lyxic8H4CUitqYmlBiZR6_nsibdqPAg4_uA3XvtOg/s320/social_icons.jpg" width="320" /></a></div>
<br />
<br />
Knowing exactly which social meta tags to include can be confusing even to experienced webmasters. This post is a huge help, and Wordpress publishers who use Yoast's SEO plugin are well ahead of the game. For the rest of us, consider the different structures supported by the major social platforms:<br />
<ol style="text-align: left;">
<li><b>Twitter Cards:</b> Summaries, Images, Galleries, Apps, Video, Audio, and Products</li>
<li><b>Pinterest Rich Pins: </b>Products, Recipes, Movies, and Articles</li>
<li><b>Google+:</b> Articles, Blog, Book, Event, Local Business, Organization, Person, Product, and Reviews</li>
<li><b>Facebook:</b> Articles, Photos, Audio, Video, and more</li>
</ol>
<h2 style="text-align: left;">
How to use these templates</h2>
<h3 style="text-align: left;">
1. The Minimal Template</h3>
<div>
<div>
This slimmed back version runs lean and fast. It contains a bare minimum of data for optimized sharing across Twitter, Facebook, Google+ and Pinterest.</div>
<div style="text-align: left;">
<span style="font-family: "courier new" , "courier" , monospace;"><br /><!-- Place this data between the <head> tags of your website --><br /><title>Page Title. Maximum length 60-70 characters</title><br /><meta name="description" content="Page description. No longer than 155 characters." /><br /><!-- Twitter Card data --><br /><meta name="twitter:card" value="summary"><br /><!-- Open Graph data --><br /><meta property="og:title" content="Title Here" /><br /><meta property="og:type" content="article" /><br /><meta property="og:url" content="http://www.example.com/" /><br /><meta property="og:image" content="http://example.com/image.jpg" /><br /><meta property="og:description" content="Description Here" /></span></div>
</div>
<div style="text-align: left;">
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<h3 style="text-align: left;">
<span style="font-family: "courier new" , "courier" , monospace;">2</span>: The Standard Template</h3>
<div>
<div>
The standard template represents a more robust implementation of social tags and is meant to work across all platforms. In addition to all of the features of the mimimal template above, the standard template includes the following:</div>
<div>
<br /></div>
<div>
<ul style="text-align: left;">
<li>The basic Twitter Summary card</li>
<li>Twitter thumbnail image</li>
<li>Facebook Page Insights</li>
</ul>
<div>
<br /></div>
</div>
</div>
<div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><!-- Place this data between the <head> tags of your website --></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><title>Page Title. Maximum length 60-70 characters</title></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta name="description" content="Page description. No longer than 155 characters." /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><!-- Twitter Card data --></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta name="twitter:card" content="summary"></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta name="twitter:site" content="@publisher_handle"></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta name="twitter:title" content="Page Title"></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta name="twitter:description" content="Page description less than 200 characters"></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta name="twitter:creator" content="@author_handle"></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><-- Twitter Summary card images must be at least 120x120px --></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta name="twitter:image" content="http://www.example.com/image.jpg"></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><!-- Open Graph data --></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta property="og:title" content="Title Here" /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta property="og:type" content="article" /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta property="og:url" content="http://www.example.com/" /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta property="og:image" content="http://example.com/image.jpg" /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta property="og:description" content="Description Here" /> </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta property="og:site_name" content="Site Name, i.e. Moz" /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta property="fb:admins" content="Facebook numeric ID" /></span></div>
</div>
<div>
<br /></div>
<h3 style="text-align: left;">
3: The Full Script</h3>
<div>
<div>
In addition to all the data contained in the standard template, the full template contains:</div>
<div>
<ul style="text-align: left;">
<li>Google Authorship and Publisher Markup. Although this data doesn't change your content appearance in Google+, it potentially add links to your Google+ pages in search results.</li>
<li>Schema.org article markup</li>
<li>Twitter Summary card with large image</li>
<li>Expanded Open Graph article data</li>
</ul>
</div>
</div>
<div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><!-- Update your html tag to include the itemscope and itemtype attributes. --></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><html itemscope itemtype="http://schema.org/Article"></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><!-- Place this data between the <head> tags of your website --></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><title>Page Title. Maximum length 60-70 characters</title></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta name="description" content="Page description. No longer than 155 characters." /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><!-- Schema.org markup for Google+ --></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta itemprop="name" content="The Name or Title Here"></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta itemprop="description" content="This is the page description"></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta itemprop="image" content="http://www.example.com/image.jpg"></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><!-- Twitter Card data --></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta name="twitter:card" content="summary_large_image"></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta name="twitter:site" content="@publisher_handle"></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta name="twitter:title" content="Page Title"></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta name="twitter:description" content="Page description less than 200 characters"></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta name="twitter:creator" content="@author_handle"></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><!-- Twitter summary card with large image must be at least 280x150px --></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta name="twitter:image:src" content="http://www.example.com/image.jpg"></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><!-- Open Graph data --></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta property="og:title" content="Title Here" /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta property="og:type" content="article" /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta property="og:url" content="http://www.example.com/" /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta property="og:image" content="http://example.com/image.jpg" /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta property="og:description" content="Description Here" /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta property="og:site_name" content="Site Name, i.e. Moz" /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta property="article:published_time" content="2013-09-17T05:59:00+01:00" /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta property="article:modified_time" content="2013-09-16T19:08:47+01:00" /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta property="article:section" content="Article Section" /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta property="article:tag" content="Article Tag" /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta property="fb:admins" content="Facebook numberic ID" /></span></div>
</div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<h3 style="text-align: left;">
<span style="font-family: inherit;">4. Bonus: The Product Template</span></h3>
<div>
<div>
For merchants, product markup is very popular, and usually easy for developers to implement in their shopping cart software. The product template differs from article markup in only a few ways:</div>
<div>
<br /></div>
<div>
<ul style="text-align: left;">
<li>Modified <html> tag to reflect schema.org product data</li>
<li>Twitter Product Card includes required data labels</li>
<li>Open Graph data includes price and currency data</li>
</ul>
</div>
</div>
<div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><!-- Update your html tag to include the itemscope and itemtype attributes. --></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><html itemscope itemtype="http://schema.org/Product"></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><!-- Place this data between the <head> tags of your website --></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><title>Page Title. Maximum length 60-70 characters</title></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta name="description" content="Page description. No longer than 155 characters." /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><!-- Schema.org markup for Google+ --></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta itemprop="name" content="The Name or Title Here"></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta itemprop="description" content="This is the page description"></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta itemprop="image" content="http://www.example.com/image.jpg"></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><!-- Twitter Card data --></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta name="twitter:card" content="product"></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta name="twitter:site" content="@publisher_handle"></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta name="twitter:title" content="Page Title"></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta name="twitter:description" content="Page description less than 200 characters"></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta name="twitter:creator" content="@author_handle"></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta name="twitter:image" content="http://www.example.com/image.jpg"></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta name="twitter:data1" content="$3"></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta name="twitter:label1" content="Price"></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta name="twitter:data2" content="Black"></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta name="twitter:label2" content="Color"></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><!-- Open Graph data --></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta property="og:title" content="Title Here" /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta property="og:type" content="article" /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta property="og:url" content="http://www.example.com/" /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta property="og:image" content="http://example.com/image.jpg" /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta property="og:description" content="Description Here" /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta property="og:site_name" content="Site Name, i.e. Moz" /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta property="og:price:amount" content="15.00" /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><meta property="og:price:currency" content="USD" /></span></div>
</div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: inherit;">Use these templates as a starting point, but you can customize them in millions of ways.</span></div>
</div>
kiranhttp://www.blogger.com/profile/02602195715866242058noreply@blogger.com0tag:blogger.com,1999:blog-3402343847615925802.post-1403056181899878522017-03-15T12:24:00.001-07:002017-03-15T12:24:12.465-07:00permalink problem for wordpress site on iis<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxTDc4Eg3oJGhIX9TFifVetN8P2_QdyzvpCtGd5pEeSQOAOeLlisO0PPmM-XFZW4SNJjVBlPcj_SSaGNNip-nTRngf3PRo8R7pML0p661H20Z08KveaAs8qnJ-AajPGEA2aBhH01qYc6Q/s1600/windows-server-iis7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="120" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxTDc4Eg3oJGhIX9TFifVetN8P2_QdyzvpCtGd5pEeSQOAOeLlisO0PPmM-XFZW4SNJjVBlPcj_SSaGNNip-nTRngf3PRo8R7pML0p661H20Z08KveaAs8qnJ-AajPGEA2aBhH01qYc6Q/s320/windows-server-iis7.png" width="320" /></a></div>
<br />
<br />
<?xml version="1.0" encoding="UTF-8"?><br />
<configuration><br />
<system.webServer><br />
<rewrite><br />
<rules><br />
<rule name="Main Rule" stopProcessing="true"><br />
<match url=".*" /><br />
<conditions logicalGrouping="MatchAll"><br />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /><br />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /><br />
</conditions><br />
<action type="Rewrite" url="index.php" /><br />
</rule><br />
</rules><br />
</rewrite><br />
</system.webServer><br />
</configuration></div>
kiranhttp://www.blogger.com/profile/02602195715866242058noreply@blogger.com0tag:blogger.com,1999:blog-3402343847615925802.post-61779754259967773982015-11-08T00:03:00.000-08:002015-11-08T00:03:41.126-08:00Social Follower Count using PHP<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6OfZZwtoka85kPLPxSgFAc2jnYjeNgF4kAVUosxbfJb9lgY38IsanXqGzlgLJLrXupdw3xnRm2ih3DawtfydEE50ogzeqwPSEjni47JjKE0QuAY1gNNx4iUvt-JfefUlk4Vrof7II5Vw/s1600/1013-icons-38%255B1%255D.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="174" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6OfZZwtoka85kPLPxSgFAc2jnYjeNgF4kAVUosxbfJb9lgY38IsanXqGzlgLJLrXupdw3xnRm2ih3DawtfydEE50ogzeqwPSEjni47JjKE0QuAY1gNNx4iUvt-JfefUlk4Vrof7II5Vw/s320/1013-icons-38%255B1%255D.jpg" width="320" /></a></div>
This post will help you to find snippets to get followers count for social platforms like Facebook, Twitter, Google plus, Youtube, Instagram, Pinterest and Tumblr.<br />
<br />
<b>Facebook Followers Count</b><br />
<pre class="gk-code" data-style="style1" style="background: rgb(250, 250, 250); border: 1px solid rgb(229, 229, 229); color: #666666; font-family: monospace, serif; font-size: 12px; line-height: 26px; outline: none !important; padding: 10px 20px; white-space: pre-wrap; word-wrap: break-word;"><code style="font-family: monospace, serif; font-size: 1em; outline: none !important;">$FBFollowercount = file_get_contents('http://api.facebook.com/method/fql.query?format=json&query=select+fan_count+from+page+where+page_id%3D355692061120689');
$data = json_decode($FBFollow);
echo $data[0]->fan_count;</code></pre>
<br />
<b>Twitter followers Count</b><br />
<pre class="gk-code" data-style="style1" style="background: rgb(250, 250, 250); border: 1px solid rgb(229, 229, 229); color: #666666; font-family: monospace, serif; font-size: 12px; line-height: 26px; outline: none !important; padding: 10px 20px; white-space: pre-wrap; word-wrap: break-word;"><code style="font-family: monospace, serif; font-size: 1em; outline: none !important;">require_once 'twitteroauth.php';
define("CONSUMER_KEY", "****consumer key*******");
define("CONSUMER_SECRET", "*******Consumer secret********");
define("OAUTH_TOKEN", "**********Oauth token*******");
define("OAUTH_SECRET", "*****Oauth Secret********");
$username = 'Walkswithmenet'; //Your twitter screen name or page name
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, OAUTH_TOKEN, OAUTH_SECRET);
$followers = $connection->get('https://api.twitter.com/1.1/users/show.json?screen_name='.$username);
echo ($followers->followers_count);</code></pre>
<br />
<b>Google Plus Followers Count</b><br />
<pre class="gk-code" data-style="style1" style="background: rgb(250, 250, 250); border: 1px solid rgb(229, 229, 229); color: #666666; font-family: monospace, serif; font-size: 12px; line-height: 26px; outline: none !important; padding: 10px 20px; white-space: pre-wrap; word-wrap: break-word;"><code style="font-family: monospace, serif; font-size: 1em; outline: none !important;">/ get api https://code.google.com/apis/console?hl=en#access
$google_api_key = 'YOUR_API';
$page_id = 'YOUR_PAGE_ID';
$data = @file_get_contents("https://www.googleapis.com/plus/v1/people/$page_id?key=$google_api_key");
$data = json_decode($data, true);
echo $data['plusOneCount'];</code></pre>
<b><br /></b>
<b>Youtube Subscribers</b><br />
<pre class="gk-code" data-style="style1" style="background: rgb(250, 250, 250); border: 1px solid rgb(229, 229, 229); color: #666666; font-family: monospace, serif; font-size: 12px; line-height: 26px; outline: none !important; padding: 10px 20px; white-space: pre-wrap; word-wrap: break-word;"><code style="font-family: monospace, serif; font-size: 1em; outline: none !important;">$channel_name = 'Your Channel';
$data = file_get_contents("http://gdata.youtube.com/feeds/api/users/$channel_name?alt=json");
$data = json_decode($data, true);
$subscribersDetails = $data['entry']['yt$statistics'];
echo $subscribersDetails['subscriberCount'].'<br />';
echo $subscribersDetails['viewCount'].'<br />';</code></pre>
<br />
<b>Instagram Followers</b><br />
Register the app you will get an API Key and secret.<br />
<pre class="gk-code" data-style="style1" style="background: rgb(250, 250, 250); border: 1px solid rgb(229, 229, 229); color: #666666; font-family: monospace, serif; font-size: 12px; line-height: 26px; outline: none !important; padding: 10px 20px; white-space: pre-wrap; word-wrap: break-word;"><code style="font-family: monospace, serif; font-size: 1em; outline: none !important;">$api_key = 'API_KEY';
$user_id = 'UID';
$data = @file_get_contents("https://api.instagram.com/v1/users/$user_id/?client_id=$api_key");
$data = json_decode($data, true);
echo '<pre/>';
print_r($data);
echo $data['data']['counts']['followed_by'];</code></pre>
<b><br /></b>
<b>Pinterest Followers Count</b><br />
<pre class="gk-code" data-style="style1" style="background: rgb(250, 250, 250); border: 1px solid rgb(229, 229, 229); color: #666666; font-family: monospace, serif; font-size: 12px; line-height: 26px; outline: none !important; padding: 10px 20px; white-space: pre-wrap; word-wrap: break-word;"><code style="font-family: monospace, serif; font-size: 1em; outline: none !important;">$metas = get_meta_tags('http://pinterest.com/YOUR PINTREST ACCOUNT NAME/');
print_r($metas['pinterestapp:followers']);</code></pre>
<br />
<b>Tumblr Likes</b><br />
Login to Tumblr -> Setting Menu -> APP ->Register your APP get the API Key and secret key.<br />
<pre class="gk-code" data-style="style1" style="background: rgb(250, 250, 250); border: 1px solid rgb(229, 229, 229); color: #666666; font-family: monospace, serif; font-size: 12px; line-height: 26px; outline: none !important; padding: 10px 20px; white-space: pre-wrap; word-wrap: break-word;"><code style="font-family: monospace, serif; font-size: 1em; outline: none !important;">$api_key = 'API_KEY';
$blog_name = 'Blog_name';
$data = @file_get_contents("http://api.tumblr.com/v2/blog/$blog_name/info?api_key=$api_key");
$data = json_decode($data, true);
echo '<pre/>';
print_r($data);
echo $data['response']['blog']['likes'];</code></pre>
<br />
<br /></div>
kiranhttp://www.blogger.com/profile/02602195715866242058noreply@blogger.com10tag:blogger.com,1999:blog-3402343847615925802.post-40163316699964467312015-11-07T23:19:00.000-08:002017-03-15T12:45:40.380-07:00Custom Social Share Buttons<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIPkIXlm248oPUrmukmiPbdvodnb64oTvxZEwJuYnVYYOaqIDV28NK5t11szOSpp5RwUc0ZfU_2-_N1usXPyqJLA0oqU24gwv5GSNTWc0nrKZqHEg7lagfwIo3o1K9u8fAV8lgROtV8Q4/s1600/social_icons.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="174" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIPkIXlm248oPUrmukmiPbdvodnb64oTvxZEwJuYnVYYOaqIDV28NK5t11szOSpp5RwUc0ZfU_2-_N1usXPyqJLA0oqU24gwv5GSNTWc0nrKZqHEg7lagfwIo3o1K9u8fAV8lgROtV8Q4/s320/social_icons.jpg" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
Now a days social media is important part of web development and brand promotions. Social share buttons are widely used things on a web site, while developing each site we concentrate how we can use all buttons,icons images are very close to the template.<br />
<br />
This article will help to create custom social share buttons for Facebook, Google Plus, Pinterest, Tumblr , Twitter and Linked In.<br />
<br />
<b>For Facebook share button.</b><br />
<pre class="gk-code" data-style="style1" style="background: rgb(250, 250, 250); border: 1px solid rgb(229, 229, 229); color: #666666; font-family: monospace, serif; font-size: 12px; line-height: 26px; outline: none !important; padding: 10px 20px; white-space: pre-wrap; word-wrap: break-word;"><code style="font-family: monospace, serif; font-size: 1em; outline: none !important;"><a id="ref_fb" href="http://www.facebook.com/sharer.php?s=100&amp;p[title]=<?php echo $title;?>&amp;p[summary]=<?php echo $description;?>&amp;p[url]=<?php echo urlencode($share_url);?>&amp;
p[images][0]=<?php echo $image_url;?>" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=no,scrollbars=no,height=400,width=600'); return false;"><img src="your custom facebook share button image" alt=""/></a></code></pre>
<b><br /></b>
<b>Twitter Share Button</b><br />
<pre class="gk-code" data-style="style1" style="background: rgb(250, 250, 250); border: 1px solid rgb(229, 229, 229); color: #666666; font-family: monospace, serif; font-size: 12px; line-height: 26px; outline: none !important; padding: 10px 20px; white-space: pre-wrap; word-wrap: break-word;"><code style="font-family: monospace, serif; font-size: 1em; outline: none !important;"><a id="ref_tw" href="http://twitter.com/home?status=<?php echo $title; ?>+<?php echo urlencode($share_url);?>" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=no,scrollbars=no,height=400,width=600');return false;"><img src="your custom twitter share button image" alt=""/></a></code></pre>
<b><br /></b>
<b>Google Plus share button</b><br />
<pre class="gk-code" data-style="style1" style="background: rgb(250, 250, 250); border: 1px solid rgb(229, 229, 229); color: #666666; font-family: monospace, serif; font-size: 12px; line-height: 26px; outline: none !important; padding: 10px 20px; white-space: pre-wrap; word-wrap: break-word;"><code style="font-family: monospace, serif; font-size: 1em; outline: none !important;"><a id="ref_gp" href="https://plus.google.com/share?url=<?php echo urlencode($share_url);?>"
onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=no,scrollbars=no,height=400,width=600');return false"><img src="your custom gplus share button image" alt=""/></a></code></pre>
<b><br /></b>
<b>Pinterest share button.</b><br />
<pre class="gk-code" data-style="style1" style="background: rgb(250, 250, 250); border: 1px solid rgb(229, 229, 229); color: #666666; font-family: monospace, serif; font-size: 12px; line-height: 26px; outline: none !important; padding: 10px 20px; white-space: pre-wrap; word-wrap: break-word;"><code style="font-family: monospace, serif; font-size: 1em; outline: none !important;"><a id="ref_pr" href="http://pinterest.com/pin/create/bookmarklet/?media=<?php echo urlencode($share_image);?>&amp;
url=<?php echo urlencode($share_url);?>&amp;
is_video=false&amp;description=<?php echo $description;?>"
onclick="javascript:window.open(this.href, '_blank', 'menubar=no,toolbar=no,resizable=no,scrollbars=no,height=400,width=600');return false;"><img src="your custom pin share button image" alt=""/></a></code></pre>
<b><br /></b>
<b>Linked In share button.</b><br />
<pre class="gk-code" data-style="style1" style="background: rgb(250, 250, 250); border: 1px solid rgb(229, 229, 229); color: #666666; font-family: monospace, serif; font-size: 12px; line-height: 26px; outline: none !important; padding: 10px 20px; white-space: pre-wrap; word-wrap: break-word;"><code style="font-family: monospace, serif; font-size: 1em; outline: none !important;"><a id="ref_lkd" href="http://www.linkedin.com/shareArticle?mini=true&url=<?php echo urlencode($share_url);?>&title=<?php echo strip_tags($title); ?>&source=<?php echo urlencode($siteurl);?>"
onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=no,scrollbars=no,height=400,width=600');return false;"><img src="your custom pin share button image" alt=""/></a></code></pre>
<b><br /></b>
<b>Tumblr share button.</b><br />
<pre class="gk-code" data-style="style1" style="background: rgb(250, 250, 250); border: 1px solid rgb(229, 229, 229); color: #666666; font-family: monospace, serif; font-size: 12px; line-height: 26px; outline: none !important; padding: 10px 20px; white-space: pre-wrap; word-wrap: break-word;"><code style="font-family: monospace, serif; font-size: 1em; outline: none !important;"><a id="ref_tum" href="http://www.tumblr.com/share/photo?source=<?php echo urlencode($share_image);?>&amp;caption=<?php echo $description;?>&amp;clickthru=<?php echo urlencode($share_url);?>"
onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=no,scrollbars=no,height=400,width=600');return false;"><img src="your custom pin share button image" alt=""/></a></code></pre>
<br />
<b>Dynamically reate Social </b><b>share buttons</b><br />
<pre class="gk-code" data-style="style1" style="background: rgb(250, 250, 250); border: 1px solid rgb(229, 229, 229); color: #666666; font-family: monospace, serif; font-size: 12px; line-height: 26px; outline: none !important; padding: 10px 20px; white-space: pre-wrap; word-wrap: break-word;"><code style="font-family: monospace, serif; font-size: 1em; outline: none !important;">var share_url = "your url to share" ;
var share_image = "your image to share";
//full url not ../images should be http://www.
var title = "title";
var description = "description";
//title and description should be formatted ie, remove all special char otherwise it may creates errors on social media sites.
var FB_url = "http://www.facebook.com/sharer.php?s=100&p[title]="+(title)+"&p[summary]="+description+"&p[url]="+encodeURIComponent(share_url)+"&p[images][0]="+(share_image);
var GP_url = "https://plus.google.com/share?url="+encodeURIComponent(share_url);
var TW_url = "http://twitter.com/home?status="+escape(title)+"+"+encodeURIComponent(share_url);
var Pt_url = "http://pinterest.com/pin/create/bookmarklet/?media="+encodeURIComponent(share_image)+"&url="+encodeURIComponent(share_url)+"& is_video=false&description="+description;
var TB_url = "http://www.tumblr.com/share/photo?source="+encodeURIComponent(share_image)+"&caption="+(description)+"&clickthru="+encodeURIComponent(share_url);
var LK_url = "http://www.linkedin.com/shareArticle?mini=true&url="+encodeURIComponent(share_url)+"&title="+(title)+"&source="+encodeURIComponent(siteurl);
jQuery("#ref_fb").attr('href',FB_url);
jQuery("#ref_gp").attr('href',GP_url);
jQuery("#ref_tw").attr('href',TW_url);
jQuery("#ref_pr").attr('href',Pt_url);
jQuery("#ref_tum").attr('href',TB_url);
jQuery("#ref_lkd").attr('href',LK_url);</code></pre>
<br />
Note: please make sure to add jquery library in page.<br />
<br /></div>
kiranhttp://www.blogger.com/profile/02602195715866242058noreply@blogger.com0tag:blogger.com,1999:blog-3402343847615925802.post-35109946468806678382015-08-21T00:35:00.000-07:002017-03-15T12:17:40.719-07:00get utm paramater from url in javascript<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-4qG-RGYMom3S9hCpE6PmsDCQXGCyd7o6xkEbhzZ4IcEF7GXnoy2mjkSQxskif_KUIifRZNBLLSKOLLgY9dBe1PmDzUEE8poyKpk2feIfNsLTxU-bgw_5hb8wA9FspKAl_xtwRw6qelg/s1600/js.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="123" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-4qG-RGYMom3S9hCpE6PmsDCQXGCyd7o6xkEbhzZ4IcEF7GXnoy2mjkSQxskif_KUIifRZNBLLSKOLLgY9dBe1PmDzUEE8poyKpk2feIfNsLTxU-bgw_5hb8wA9FspKAl_xtwRw6qelg/s200/js.png" width="200" /></a></div>
<br />
<br />
UTM paramaters are widely used in adcampaigns to check sources are traffice. google ads and other ads send a parameters, such as utm_source, utm_medium, utm_campaign in urls. <br />
<br />
Some of the utm paramaters are as follows:-<br />
1) <b>Campaign Source (utm_source) </b>– Required parameter to identify the source
of your traffic such as: search engine, newsletter, or other referral.<br />
2) <b>Campaign Medium (utm_medium)</b> – Required parameter to identify the medium
the link was used upon such as: email, CPC, or other method of sharing.<br />
3) <b>Campaign Term (utm_term)</b> – Optional parameter suggested for paid search
to identify keywords for your ad. You can skip this for Google AdWords
if you have connected your AdWords and Analytics accounts and use the
auto-tagging feature instead.<br />
4) <b>Campaign Content (utm_content)</b> – Optional parameter for additional details for A/B testing and content-targeted ads.<br />
5) <b>Campaign Name (utm_campaign)</b> – Required parameter to identify a specific
product promotion or strategic campaign such as a spring sale or other
promotion.<br />
<br />
Simple code snippet to get get url paramater values for utm sources.<br />
<br />
<b>//function to get url paramaters</b><br />
function getUrlVars() {<br />
var vars = {};<br />
var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {<br />
vars[key] = value;<br />
});<br />
return vars;<br />
}<br />
<br />
<b>//variable to stor url values</b><br />
var utmsource = getUrlVars()["utm_source"];<br />
var utm_medium = getUrlVars()["utm_medium"];<br />
var utm_campaign = getUrlVars()["utm_campaign"];<br />
<br />
Similarly you can get all other valiables from url.<br />
<br /></div>
kiranhttp://www.blogger.com/profile/02602195715866242058noreply@blogger.com0tag:blogger.com,1999:blog-3402343847615925802.post-35410200377871590952015-07-30T07:11:00.001-07:002017-03-15T12:23:50.462-07:00Mobile First Media Queries for Resposive sites<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_kcL8ayXezXPyh3jhMRaPGBItSVGX4O63pcXHyd2I1Y9Cv8srS_entZ16drYXDq83jNE6J0OzNnGA3UTYEgo-aAQQ5P6qFc-D6eh_EmzssqTBTcRk1KA-4jP-CrrdjER77v8Pu7gdaHY/s1600/logo-bootstrap.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="121" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_kcL8ayXezXPyh3jhMRaPGBItSVGX4O63pcXHyd2I1Y9Cv8srS_entZ16drYXDq83jNE6J0OzNnGA3UTYEgo-aAQQ5P6qFc-D6eh_EmzssqTBTcRk1KA-4jP-CrrdjER77v8Pu7gdaHY/s200/logo-bootstrap.png" width="200" /></a></div>
<br />
<br />
Today we will look into media queries. Many peoples are searching for media queries format on google, but many times they dont get proper solution . so i am sharing Media query structure which i follow while writing css. hope this will be useful for all of you.<br />
<br />
A media query consists of a media type and at least one expression that limits the style sheets' scope by using media features, such as width, height, and color. Media queries, added in CSS3, let the presentation of content be tailored to a specific range of output devices without having to change the content itself.<br />
<br />
<b>Which direction should you choose when writing the CSS for a responsive website?</b><br />
<br />
1) Mobile First :-<br />
Start with the CSS for narrow viewports , then increase viewport and add breakpoints when needed.<br />
<br />
2) Desktop First :-<br />
Start with the CSS for wider viewports , then decrease viewport and add breakpoints when needed.<br />
<div>
<br /></div>
<b>Mobile First Structure is as follows</b><br />
<br />
/*========== Mobile First Method ==========*/<br />
<br />
/* Custom, iPhone Retina */<br />
@media only screen and (min-width : 320px){<br />
/* Some CSS Here */<br />
}<br />
<br />
/* Extra Small Devices, Phones */<br />
@media only screen and (min-width : 480px){<br />
/* Some CSS Here */<br />
}<br />
<br />
/* Small Devices, Tablets */<br />
@media only screen and (min-width : 768px){<br />
/* Some CSS Here */<br />
}<br />
<br />
/* Medium Devices, Desktops */<br />
@media only screen and (min-width : 992px){<br />
/* Some CSS Here */<br />
}<br />
<br />
/* Large Devices, Wide Screens */<br />
@media only screen and (min-width : 1200px){<br />
/* Some CSS Here */<br />
}<br />
<br />
All the best........<br />
<br />
<br /></div>
kiranhttp://www.blogger.com/profile/02602195715866242058noreply@blogger.com0tag:blogger.com,1999:blog-3402343847615925802.post-63023766964951775352015-03-08T10:55:00.001-07:002017-03-15T12:16:57.047-07:00URL Rewriting using .htaccess in PHP<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWvLmXsjK69KB-sPYCpk4gq8Hg9TjanEjnUA2YsYSn-TsStTcc75OHu_wujuCBihh6rO8Jdiv8BiDDlp384T6u_KjVOPNEIao2wcv7ab6eiEu5Rjjo3eb5otrCxtAJrwzhP0s2rV4l0NQ/s1600/PHP-Logo-Free-Download-PNG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="171" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWvLmXsjK69KB-sPYCpk4gq8Hg9TjanEjnUA2YsYSn-TsStTcc75OHu_wujuCBihh6rO8Jdiv8BiDDlp384T6u_KjVOPNEIao2wcv7ab6eiEu5Rjjo3eb5otrCxtAJrwzhP0s2rV4l0NQ/s320/PHP-Logo-Free-Download-PNG.png" width="320" /></a></div>
<br />
<br />
Benefits of Static url over Dynamic URLs<br />
1. Static URLs typically Rank better in Search Engines.<br />
2. Search Engines are known to index the content of dynamic pages a lot slower compared to static pages.<br />
3. Static URLs are always more friendlier looking to the End Users.<br />
<br />
What is the benefits of rewriting URL?<br />
When a search engine visits the dynamic url like product.php?id=3 it does not give much importance to that URL as search engine sees ? sign treat it as a url which keeps on changing. so we are converting the dynamic URL like the product.php?id=3 to static url format like product-3.html. We rewrite the url in such a way that in browser's address bar it will display as a product-3.html but it actually calls the file product.php?id=3. So that why these kind of URL also named as SEO friendly URL.<br />
<br />
What is required for URL rewriting ??<br />
To rewrite the URL you must have the mod_rewrite module must be loaded in apache server. And furthermore, FollowSymLinks options also need to be enabled otherwise you may encounter 500 Internal Sever Error.<br />
<br />
If you are looking for the examples of URL rewriting then this post might be useful for you. In this post, I've given five useful examples of URL rewriting using .htacess.<br />
<br />
Examples of url rewriting for seo friendly URL<br />
For rewriting the URL, you should create a .htaccess file in the root folder of your web directory. And have to put the following codes as your requirement.<br />
<br />
Options +FollowSymlinks<br />
RewriteEngine on<br />
RewriteRule ^(.*)\.htm$ $1.php [nc]<br />
The following example will rewrite the test.php to test.html i.e when a URL like http://localhost/test.htm is called in address bar it calls the file test.php. As you can see the regular expression in first part of the RewriteRule command and $1 represents the first regular expression of the part of the RewriteRule and [nc] means not case sensitive.<br />
<br />
Options +FollowSymlinks<br />
RewriteEngine on<br />
RewriteRule ^product-([0-9]+)\.html$ products.php?id=$1<br />
The following example will rewrite the product.php?id=5 to porduct-5.html i.e when a URL like http://localhost/product-5.html calls product.php?id=5 automatically.<br />
<br />
SEO expert always suggest to display the main keyword in the URL. In the following URL rewriting technique you can display the name of the product in URL.<br />
<br />
RewriteEngine on<br />
RewriteRule ^product/([a-zA-Z0-9_-]+)/([0-9]+)\.html$ product.php?id=$2<br />
If you like to do like http://yoursite.com/xyz to http://yoursite.com/user.php?username=xyz then you can add the following code to the .htaccess file.<br />
<br />
RewriteEngine On<br />
RewriteRule ^([a-zA-Z0-9_-]+)$ user.php?username=$1<br />
RewriteRule ^([a-zA-Z0-9_-]+)/$ user.php?username=$1<br />
Suppose the you've redeveloped your site and all the new development reside inside the “new†folder of inside root folder.Then the new development of the website can be accessed like “test.com/newâ€. Now moving these files to the root folder can be a hectic process so you can create the following code inside the .htaccess file and place it under the root folder of the website. In result, www.test.com point out to the files inside “new†folder.<br />
<br />
RewriteEngine On<br />
RewriteCond %{HTTP_HOST} ^test\.com$ [OR]<br />
RewriteCond %{HTTP_HOST} ^www\.test\.com$<br />
RewriteCond %{REQUEST_URI} !^/new/<br />
RewriteRule (.*) /new/$1<br />
<br />
Hope this post will be helpful as other posts.</div>
kiranhttp://www.blogger.com/profile/02602195715866242058noreply@blogger.com0tag:blogger.com,1999:blog-3402343847615925802.post-25367774962596029532015-01-02T11:35:00.001-08:002017-03-15T12:29:20.807-07:00Parameter passing to CURL GET Request<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEioJuT18rcpUme8MUZZh8ADNbjkxa4AjZxwXszlu3t9WxL6f9W2H2C2518Y_H7A7DIYXaRv2xk7s0u1PrTtbHo4Jj-g0i2DNoLKutcW6rzSbBU3XFqcueses4OKWXaR7Gmhdx-t8HSUePo/s1600/php7-transparent.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEioJuT18rcpUme8MUZZh8ADNbjkxa4AjZxwXszlu3t9WxL6f9W2H2C2518Y_H7A7DIYXaRv2xk7s0u1PrTtbHo4Jj-g0i2DNoLKutcW6rzSbBU3XFqcueses4OKWXaR7Gmhdx-t8HSUePo/s200/php7-transparent.png" width="141" /></a></div>
<br />
<br />
This is simple example to pass parameters to php curl get method<br />
<br />
<?php<br />
<br />
/* Script URL */<br />
$url = 'http://www.example.com/abc.php';<br />
<br />
/* $_GET Parameters to Send */<br />
$params = array('param1' => 'value1', 'param2' => 'value2');<br />
<br />
/* Update URL to container Query String of Paramaters */<br />
$url .= '?' . http_build_query($params);<br />
<br />
/* cURL Resource */<br />
$ch = curl_init();<br />
<br />
/* Set URL */<br />
curl_setopt($ch, CURLOPT_URL, $url);<br />
<br />
/* Tell cURL to return the output */<br />
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);<br />
<br />
/* Tell cURL NOT to return the headers */<br />
curl_setopt($ch, CURLOPT_HEADER, false);<br />
<br />
/* Execute cURL, Return Data */<br />
$data = curl_exec($ch);<br />
<br />
/* Check HTTP Code */<br />
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);<br />
<br />
/* Close cURL Resource */<br />
curl_close($ch);<br />
<br />
/* 200 Response! */<br />
if ($status == 200) {<br />
<br />
/* Debug */<br />
var_dump($data);<br />
<br />
} else {<br />
<br />
/* Debug */<br />
var_dump($data);<br />
var_dump($status);<br />
<br />
}<br />
<br />
?></div>
kiranhttp://www.blogger.com/profile/02602195715866242058noreply@blogger.com0tag:blogger.com,1999:blog-3402343847615925802.post-81273311108780739802014-07-22T02:09:00.001-07:002014-07-22T02:17:59.692-07:00Black Beauties for Techies<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Verdana, sans-serif;">Today I am listing some of the black beauties of tech world. which every techies dream to buy. For me Black is a color of new technology and gadgets. Every year the Black Friday online circulars hit the Web and lots of sites round up every tech deal under the sun. Some of the big giants like Apple and Amazon comes with lots of offers on "Black Friday shopping event".</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">Following are Some of Gadgets actually worth getting excited.</span><br />
<b><span style="font-family: Verdana, sans-serif;"><br /></span></b>
<br />
<h3 style="text-align: left;">
<b><span style="font-family: Verdana, sans-serif;">1) iPhone 5s</span></b></h3>
<div>
<b><span style="font-family: Verdana, sans-serif;"><br /></span></b></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgixqzuKF9t-_vKmuVv4GlER3mTHgvdUceXy1fcX6St2jhgRSWSQBTX6jK73LCH4b5x1ybZhPKNAcpOx92MBb0YYOudypaeM_SWzsWjlPARVVCe1euPRpHxj2W4FF6HSv_o5teCsGvjsio/s1600/iphone5-official-black.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><span style="font-family: Verdana, sans-serif;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgixqzuKF9t-_vKmuVv4GlER3mTHgvdUceXy1fcX6St2jhgRSWSQBTX6jK73LCH4b5x1ybZhPKNAcpOx92MBb0YYOudypaeM_SWzsWjlPARVVCe1euPRpHxj2W4FF6HSv_o5teCsGvjsio/s1600/iphone5-official-black.jpg" height="196" width="200" /></span></a></div>
<span style="font-family: Verdana, sans-serif;">1) iPhone 5s is the first 64‑bit smartphone in the world. And iOS 7 was designed with that in mind, built specifically for 64‑bit architecture.</span><br />
<span style="font-family: Verdana, sans-serif;">2) Beautiful industrial design and superb build quality is matched with a phone that feels almost impossibly thin and light.</span><br />
<span style="font-family: Verdana, sans-serif;">3) This is the fingerprint scanner that sits under the surface of the Home button. </span><br />
<span style="font-family: Verdana, sans-serif;">4) 4-inch IPS 1,136 x 640 pixel screen</span><br />
<span style="font-family: Verdana, sans-serif;">5) iOS 7 was the biggest update to the system since its birth back in 2007. It made the OS look and feel more modern, with a new design and better-looking screen transitions.</span><br />
<span style="font-family: Verdana, sans-serif;">6) 64-bit dual-core 1.3GHz Apple A7, 1GB RAM, PowerVR G6430 GPU</span><br />
<span style="font-family: Verdana, sans-serif;">7) 8-megapixel camera, 1/3.2-inch sensor, dual-LED ‘true tone’ flash</span><br />
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<h3 style="text-align: left;">
<span style="font-family: Verdana, sans-serif; font-size: small;"><span style="background-color: white; white-space: nowrap;">2) Apple</span><span style="white-space: nowrap;"> iPad mini 2 Retina</span></span></h3>
<div style="text-align: left;">
<span style="font-family: Verdana, sans-serif; white-space: nowrap;">1) The 7.9 inch IPS display. 2,048 x 1,536 pixels with a stunning 324 pixels per inch (ppi)</span></div>
<div style="text-align: left;">
<span style="font-family: Verdana, sans-serif;"><span style="white-space: nowrap;">2) 64-bit A7 system-on-chip processor and 1GB RAM</span></span></div>
<span style="font-family: Verdana, sans-serif;"><span style="white-space: nowrap;">3) Come with IOS 7</span></span><br />
<span style="font-family: Verdana, sans-serif;"><span style="white-space: nowrap;">4) 5MP rear camera</span></span><span style="font-family: Verdana, sans-serif; white-space: nowrap;">5) bigger battery, from 16.3 Wh to 23.8 Wh</span><br />
<div style="text-align: left;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/proxy/AVvXsEivzwcT2TSlxtR83xDNczZ_jdlhvR4RzVT8WbBrLSZAbDs7QTomtBcrmPC9TFNMakHQ2vo66WVcL2ghuS4lBfJeIHvzU-xgkY517X1NZyQ-rS-R22ihXgHoNS6wO4Lv4ZLhQZFvdTWynlef4re4PnLfHUiaaua8LX3UlE1I_4znq6xOWJ1Y_vOtle1NQmj-zQA=" imageanchor="1" style="margin-left: 1em; margin-right: 1em; text-align: center; white-space: normal;"><span style="font-family: Verdana, sans-serif;"><img border="0" src="http://dzfocdn.dazeinfo.com/wp-content/uploads/2014/01/apple-ipad-mini-black.jpg" height="211" width="320" /></span></a></div>
<br />
<br /></div>
<h3 class="r" style="background-color: white; font-size: medium; font-weight: normal; margin: 0px; overflow: hidden; padding: 0px; text-overflow: ellipsis; white-space: nowrap;">
<span style="font-weight: bold;"><span style="font-family: Verdana, sans-serif;">3) MacBook Pro</span></span></h3>
<div>
<span style="font-weight: bold;"><span style="font-family: Verdana, sans-serif;"><br /></span></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://technabob.com/blog/wp-content/uploads/2012/05/moshi_iglaze_black.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-left: 1em;"><span style="color: black; font-family: Verdana, sans-serif;"><img border="0" src="http://technabob.com/blog/wp-content/uploads/2012/05/moshi_iglaze_black.jpg" height="168" width="320" /></span></a></div>
<span style="font-family: Verdana, sans-serif;">1) <span style="line-height: 16.00299835205078px;">OS X Mavericks. The world's most advanced desktop operating system.</span></span><br />
<span style="font-family: Verdana, sans-serif;">2) Thin. Light. Powerful. There’s innovation in every nanometre.</span><br />
<span style="font-family: Verdana, sans-serif;">3) <span style="line-height: 16.00299835205078px;">With fourth-generation dual-core and quad-core Intel processors</span></span><br />
<span style="font-family: Verdana, sans-serif;">4) Every new MacBook Pro comes with better-than-ever versions of iPhoto, iMovie, GarageBand, Pages, Numbers and Keynote.</span><br />
<span style="font-family: Verdana, sans-serif;">5) <span style="line-height: 16.00299835205078px;">the latest graphics, PCIe-based flash storage, 802.11ac Wi‑Fi</span></span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<br />
<h3 class="r" style="background-color: white; margin: 0px; overflow: hidden; padding: 0px; text-overflow: ellipsis; white-space: nowrap;">
<span style="font-family: Verdana, sans-serif; font-size: small;">4) Nikon D5300 DSLR Camera</span></h3>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://www.kogan.com/media/tcache/3e/33/3e3307493cfcc52b6b82403efb9e8ce9.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><span style="color: black; font-family: Verdana, sans-serif;"><img border="0" src="http://www.kogan.com/media/tcache/3e/33/3e3307493cfcc52b6b82403efb9e8ce9.jpg" height="213" width="320" /></span></a></div>
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">1) <span style="background-color: white; line-height: 16.00299835205078px;">24.2-megapixel DX-format CMOS sensor with the optical low pass filter (OLPF) removed to improve clarity and detail in images</span></span><br />
<span style="font-family: Verdana, sans-serif;">2) <span style="background-color: white; line-height: 19.5px;">3.2-inch vari-angle LCD screen</span></span><br />
<span style="font-family: Verdana, sans-serif;">3) <span style="background-color: white; line-height: 16.00299835205078px;">capable of capturing images at a 5fps rate</span></span><br />
<span style="font-family: Verdana, sans-serif;">4) <span style="background-color: white; line-height: 16.00299835205078px;">built-in Wi-Fi, the Nikon D5300 can transmit images and videos to any iOS and Android smartphone or tablet</span></span><br />
<span style="font-family: Verdana, sans-serif;">5) <span style="background-color: white; line-height: 16.00299835205078px;">GPS function, images can also be geotagged</span></span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<br />
<h3 class="r" style="background-color: white; font-size: medium; font-weight: normal; margin: 0px; overflow: hidden; padding: 0px; text-overflow: ellipsis; white-space: nowrap;">
<span style="font-family: Verdana, sans-serif;"><span style="font-weight: bold;">5) Xbox One</span> with <span style="font-weight: bold;">Kinect 2.0</span></span></h3>
<span style="font-family: Verdana, sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<a href="http://t3.gstatic.com/images?q=tbn:ANd9GcSVromhWikf9oTL0-C6uadq3eJkFACSkSyFr4okHjvYle9smhcC" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-left: 1em;"><span style="color: black; font-family: Verdana, sans-serif;"><img border="0" src="http://t3.gstatic.com/images?q=tbn:ANd9GcSVromhWikf9oTL0-C6uadq3eJkFACSkSyFr4okHjvYle9smhcC" /></span></a><span style="font-family: Verdana, sans-serif;">1) <span style="background-color: white; line-height: 19.5px;">Advanced motion sensor</span></span><br />
<span style="font-family: Verdana, sans-serif;">2) <span style="background-color: white; line-height: 27.200000762939453px;">Voice commands</span></span><br />
<span style="font-family: Verdana, sans-serif;">3) <span style="background-color: white; line-height: 24px;">come with a full 1080p RBG camera for HD detection that may help with facial recognition</span></span><br />
<span style="font-family: Verdana, sans-serif;">4) Xbox One takes on set top TV boxes</span><br />
<span style="font-family: Verdana, sans-serif;">5) <span style="background-color: white; line-height: 24px;">Multitasking</span></span><br />
<span style="font-family: Verdana, sans-serif;"><span style="background-color: white; line-height: 24px;">6) HDMI-IN PORT</span><span style="font-size: x-small;"><span style="background-color: white; line-height: 24px;"><br /><b><br /></b></span></span></span><br />
<h3 style="text-align: left;">
<span style="font-family: Verdana, sans-serif;"><span style="background-color: white; line-height: 24px;"><b><span style="font-size: small;">6)</span><span style="font-size: x-small;"> </span></b></span><b>Programming Black Book collection</b></span></h3>
<span style="font-family: Verdana, sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://t3.gstatic.com/images?q=tbn:ANd9GcRMYZ4Y7saDRocPWu-IQI0XS3OgM5E6qOK1FVznunSJyWPjtSjU" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="color: black; font-family: Verdana, sans-serif;"><img border="0" src="http://t3.gstatic.com/images?q=tbn:ANd9GcRMYZ4Y7saDRocPWu-IQI0XS3OgM5E6qOK1FVznunSJyWPjtSjU" height="87" width="400" /></span></a></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Verdana, sans-serif;">This is Specially For Computer Programmers. Black books is a awesome book series from DreamTech Publication. This books are <span style="background-color: white; line-height: 18px;">solid introduction, written from the programmer s point of view that contains hundreds of examples covering every aspect of programming languages.</span></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Verdana, sans-serif;"><span style="background-color: white; line-height: 18px;">Some of the Black books are as Follows.</span></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Verdana, sans-serif;"><span style="background-color: white; line-height: 18px;">i) </span><span style="line-height: 18px;">Java 6 Programming Black Book</span></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Verdana, sans-serif;"><span style="line-height: 18px;">ii) C, C++, C# Programming</span></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Verdana, sans-serif;"><span style="line-height: 18px;">iii) Java Server Programming JAVA EE 7</span></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Verdana, sans-serif;"><span style="background-color: white; line-height: 18px;">Read more: - </span>http://www.dreamtechpress.com/</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Verdana, sans-serif;">Hope you will like this post. Please Comment Your Suggestions to improve this blog contents.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Verdana, sans-serif;">Thank You.</span></div>
</div>
<!-- Blogger automated replacement: "https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2Fdzfocdn.dazeinfo.com%2Fwp-content%2Fuploads%2F2014%2F01%2Fapple-ipad-mini-black.jpg&container=blogger&gadget=a&rewriteMime=image%2F*" with "https://blogger.googleusercontent.com/img/proxy/AVvXsEivzwcT2TSlxtR83xDNczZ_jdlhvR4RzVT8WbBrLSZAbDs7QTomtBcrmPC9TFNMakHQ2vo66WVcL2ghuS4lBfJeIHvzU-xgkY517X1NZyQ-rS-R22ihXgHoNS6wO4Lv4ZLhQZFvdTWynlef4re4PnLfHUiaaua8LX3UlE1I_4znq6xOWJ1Y_vOtle1NQmj-zQA=" --><!-- Blogger automated replacement: "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgixqzuKF9t-_vKmuVv4GlER3mTHgvdUceXy1fcX6St2jhgRSWSQBTX6jK73LCH4b5x1ybZhPKNAcpOx92MBb0YYOudypaeM_SWzsWjlPARVVCe1euPRpHxj2W4FF6HSv_o5teCsGvjsio/s1600/iphone5-official-black.jpg" with "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgixqzuKF9t-_vKmuVv4GlER3mTHgvdUceXy1fcX6St2jhgRSWSQBTX6jK73LCH4b5x1ybZhPKNAcpOx92MBb0YYOudypaeM_SWzsWjlPARVVCe1euPRpHxj2W4FF6HSv_o5teCsGvjsio/s1600/iphone5-official-black.jpg" --><!-- Blogger automated replacement: "https://blogger.googleusercontent.com/img/proxy/AVvXsEivzwcT2TSlxtR83xDNczZ_jdlhvR4RzVT8WbBrLSZAbDs7QTomtBcrmPC9TFNMakHQ2vo66WVcL2ghuS4lBfJeIHvzU-xgkY517X1NZyQ-rS-R22ihXgHoNS6wO4Lv4ZLhQZFvdTWynlef4re4PnLfHUiaaua8LX3UlE1I_4znq6xOWJ1Y_vOtle1NQmj-zQA=" with "https://blogger.googleusercontent.com/img/proxy/AVvXsEivzwcT2TSlxtR83xDNczZ_jdlhvR4RzVT8WbBrLSZAbDs7QTomtBcrmPC9TFNMakHQ2vo66WVcL2ghuS4lBfJeIHvzU-xgkY517X1NZyQ-rS-R22ihXgHoNS6wO4Lv4ZLhQZFvdTWynlef4re4PnLfHUiaaua8LX3UlE1I_4znq6xOWJ1Y_vOtle1NQmj-zQA=" --><!-- Blogger automated replacement: "https://images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http%3A%2F%2F2.bp.blogspot.com%2F-wXflNXGVOB8%2FU836kdAAmyI%2FAAAAAAAAAIw%2FJWLpu1CAC8Y%2Fs1600%2Fiphone5-official-black.jpg&container=blogger&gadget=a&rewriteMime=image%2F*" with "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgixqzuKF9t-_vKmuVv4GlER3mTHgvdUceXy1fcX6St2jhgRSWSQBTX6jK73LCH4b5x1ybZhPKNAcpOx92MBb0YYOudypaeM_SWzsWjlPARVVCe1euPRpHxj2W4FF6HSv_o5teCsGvjsio/s1600/iphone5-official-black.jpg" -->kiranhttp://www.blogger.com/profile/02602195715866242058noreply@blogger.com0tag:blogger.com,1999:blog-3402343847615925802.post-60346782198241793952014-04-10T23:26:00.000-07:002017-03-15T12:29:39.992-07:00force download file using php<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5PMpLc7PWQ-brI8s9aRUEu5wKUtO44Yy9xSe8ZIVLK9Pfg6pQT5Qu_RXXwUxJ18VBNRZ72wGbzge1mmXOxWPlw2shnP1rsskJzdemdow_jLLL7JqgCznPPsHSbdyScNMjDD5vvESNo84/s1600/PHP-Logo-Free-Download-PNG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="107" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5PMpLc7PWQ-brI8s9aRUEu5wKUtO44Yy9xSe8ZIVLK9Pfg6pQT5Qu_RXXwUxJ18VBNRZ72wGbzge1mmXOxWPlw2shnP1rsskJzdemdow_jLLL7JqgCznPPsHSbdyScNMjDD5vvESNo84/s200/PHP-Logo-Free-Download-PNG.png" width="200" /></a></div>
<br />
<br />
By default most of the file types (eg: txt, jpg, png, gif, html, pdf, etc.) displayed in browser instead of download. But we can force browser to download these files instead of showing them.This tutorial goes over how to force file download in php.<br />
<br />
<?php<br />
//file path to download<br />
$file_name=$_GET['file'];<br />
$outputfilename = "<DOWNLOAD_FILE_NAME>";<br />
header('Content-Description: File Transfer');<br />
//set content type<br />
header('Content-Type: application/octet-stream');<br />
//file name to save it may be different from original filename<br />
header("Content-Disposition: attachment; filename=\"" . basename($outputfilename) . "\";" );<br />
//sends file size header to browser<br />
header('Content-Length: ' . filesize($file_name));<br />
header('Content-Transfer-Encoding: binary');<br />
header('Cache-Control: public');<br />
header('Pragma: public');<br />
ob_clean();<br />
//outputs file content to download stream<br />
readfile($file_name);<br />
exit;<br />
?></div>
kiranhttp://www.blogger.com/profile/02602195715866242058noreply@blogger.com0tag:blogger.com,1999:blog-3402343847615925802.post-18113474933539406282014-04-09T04:07:00.000-07:002017-03-15T12:38:19.417-07:00Add Google Plus Share Button to your site<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: left;">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_LcPVw7xaGFVRHSJ0WcKKsF-oZa7AtrfFGCWYIzCjpKU45ju8kyr4lhBN-1qkCenKDht-Olw22fU7ZyxGtaAWQlotGIx6Atu_exr6ASQhEfmrpjknUyeX4h8GU58fApTS_p4_0R8GwW8/s1600/google-plus.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_LcPVw7xaGFVRHSJ0WcKKsF-oZa7AtrfFGCWYIzCjpKU45ju8kyr4lhBN-1qkCenKDht-Olw22fU7ZyxGtaAWQlotGIx6Atu_exr6ASQhEfmrpjknUyeX4h8GU58fApTS_p4_0R8GwW8/s200/google-plus.png" width="200" /></a></div>
<span style="color: #222222; font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><span style="background-color: white; line-height: 19.2000007629395px;"><br /></span></span>
<span style="color: #222222; font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><span style="background-color: white; line-height: 19.2000007629395px;"><br /></span></span>
<span style="color: #222222; font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><span style="background-color: white; line-height: 19.2000007629395px;">Simple Tutorial to Create Google Plus Share Popup Window.</span></span></div>
<div style="text-align: left;">
<span style="color: #222222; font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><span style="background-color: white; line-height: 19.2000007629395px;"><br /></span></span></div>
<div style="text-align: left;">
<span style="color: #222222; font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><span style="background-color: white; line-height: 19.2000007629395px;">function shareongplus()</span></span></div>
<div style="text-align: left;">
<span style="color: #222222; font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><span style="background-color: white; line-height: 19.2000007629395px;">{</span></span></div>
<div style="text-align: left;">
<span style="color: #222222; font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><span style="background-color: white; line-height: 19.2000007629395px;"> var url2='https://plus.google.com/share?url='+encodeURIComponent("<URL_TO_SHARE>")+'&title='+encodeURIComponent('<TITLE_OF_SHARE>');</span></span></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<span style="color: #222222; font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><span style="background-color: white; line-height: 19.2000007629395px;"> newwindow=window.open(url2,'<TITLE_OF_POPUP>','height=450,width=650');</span></span></div>
<div style="text-align: left;">
<span style="color: #222222; font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><span style="background-color: white; line-height: 19.2000007629395px;"> if (window.focus) {newwindow.focus()}</span></span></div>
<div style="text-align: left;">
<span style="color: #222222; font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><span style="background-color: white; line-height: 19.2000007629395px;"><br /></span></span></div>
<div style="text-align: left;">
<span style="color: #222222; font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><span style="background-color: white; line-height: 19.2000007629395px;">}</span></span></div>
<div style="text-align: left;">
<span style="color: #222222; font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><span style="background-color: white; line-height: 19.2000007629395px;"><br /></span></span></div>
<div style="text-align: left;">
<span style="color: #222222; font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><span style="background-color: white; line-height: 19.2000007629395px;">Note :- You can use encodeURIComponent('Text To Encode') javascript function to encode text into url format.</span></span></div>
</div>
kiranhttp://www.blogger.com/profile/02602195715866242058noreply@blogger.com0tag:blogger.com,1999:blog-3402343847615925802.post-76994744260215446282014-04-02T00:19:00.000-07:002014-04-02T00:19:19.593-07:00Import csv file in mysql using php<div dir="ltr" style="text-align: left;" trbidi="on">
<b style="background-color: white; color: #333333; font-family: Arial; line-height: 19.200000762939453px;"><span style="color: #222222; font-family: arial, sans-serif; font-weight: normal; line-height: normal;"><br /></span></b>
<b style="background-color: white; color: #333333; font-family: Arial; line-height: 19.200000762939453px;"><span style="color: #222222; font-family: arial, sans-serif; font-weight: normal; line-height: normal;">This tutorial will go over how to import CSV ( </span></b><span style="color: #222222; font-family: arial, sans-serif;">comma separated value </span><b style="background-color: white; color: #333333; font-family: Arial; line-height: 19.200000762939453px;"><span style="color: #222222; font-family: arial, sans-serif; font-weight: normal; line-height: normal;">) file data into Mysql Database using Php . </span></b><br />
<b style="background-color: white; color: #333333; font-family: Arial; line-height: 19.200000762939453px;"><br /></b>
CSV file is should be like below<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicoFlUwO2WO8kVcyHT3y8WosxiVBhg6Luh2jxLD-UlnjJejAUXyhj1utfE93Pq2pJ97KBsoYw5pUTP7radqwaf84QOIbo2Ur7dyCbiJ4LnwIYAw7CmVvNyaowfGbuVgXhGRbyL8-WJBq4/s1600/csv-php.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicoFlUwO2WO8kVcyHT3y8WosxiVBhg6Luh2jxLD-UlnjJejAUXyhj1utfE93Pq2pJ97KBsoYw5pUTP7radqwaf84QOIbo2Ur7dyCbiJ4LnwIYAw7CmVvNyaowfGbuVgXhGRbyL8-WJBq4/s1600/csv-php.jpg" /></a></div>
<br />
<br />
<!-- form to submit csv file --><br />
<form enctype="multipart/form-data" method="post" role="form"><br />
<div class="form-group"><br />
<label for="exampleInputFile">File Upload</label><br />
<input type="file" name="file" id="file" size="150"><br />
<p class="help-block">Only CSV File Import.</p><br />
</div><br />
<button type="submit" class="btn btn-default" name="Import" value="Import">Upload</button><br />
</form><br />
<br />
<br />
//php code to process csv file and store data into mysql database<br />
<?php<br />
if(isset($_POST["Import"]))<br />
{<br />
//First we need to make a connection with the database<br />
$host='localhost'; // Host Name.<br />
$db_user= ''; //DB User Name<br />
$db_password= ''; //DB Password<br />
$db= ''; // Database Name.<br />
<br />
//Create connection with databse<br />
$conn=mysql_connect($host,$db_user,$db_password) or die (mysql_error());<br />
mysql_select_db($db) or die (mysql_error());<br />
echo $filename=$_FILES["file"]["tmp_name"];<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
if($_FILES["file"]["size"] > 0)<br />
{<br />
$file = fopen($filename, "r");<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>$count = 0;<br />
while (($emapData = fgetcsv($file, 10000, ",")) !== FALSE)<br />
{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>$count++; <br />
// ignore first row for column names<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>if($count>1)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
//insert into database<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>$sql = "INSERT into demo1(id,name) values ('$emapData[0]','$emapData[1]')";<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>mysql_query($sql);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
}<br />
fclose($file);<br />
echo 'CSV File has been successfully Imported';<br />
}<br />
else<br />
echo 'Invalid File:Please Upload CSV File';<br />
}<br />
?></div>
kiranhttp://www.blogger.com/profile/02602195715866242058noreply@blogger.com0tag:blogger.com,1999:blog-3402343847615925802.post-58699217266795311082014-03-21T03:20:00.003-07:002017-03-15T12:34:30.258-07:00Export MS SQL SERVER data in MS Excel using php<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5PMpLc7PWQ-brI8s9aRUEu5wKUtO44Yy9xSe8ZIVLK9Pfg6pQT5Qu_RXXwUxJ18VBNRZ72wGbzge1mmXOxWPlw2shnP1rsskJzdemdow_jLLL7JqgCznPPsHSbdyScNMjDD5vvESNo84/s1600/PHP-Logo-Free-Download-PNG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="107" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5PMpLc7PWQ-brI8s9aRUEu5wKUtO44Yy9xSe8ZIVLK9Pfg6pQT5Qu_RXXwUxJ18VBNRZ72wGbzge1mmXOxWPlw2shnP1rsskJzdemdow_jLLL7JqgCznPPsHSbdyScNMjDD5vvESNo84/s200/PHP-Logo-Free-Download-PNG.png" width="200" /></a></div>
<b style="background-color: white; color: #333333; font-family: Arial; font-size: small; line-height: 19.200000762939453px;"><span style="color: #222222; font-family: "arial" , sans-serif; font-weight: normal; line-height: normal;"><br /></span></b>
<b style="background-color: white; color: #333333; font-family: Arial; font-size: small; line-height: 19.200000762939453px;"><span style="color: #222222; font-family: "arial" , sans-serif; font-weight: normal; line-height: normal;"><br /></span></b>
<b style="background-color: white; color: #333333; font-family: Arial; font-size: small; line-height: 19.200000762939453px;"><span style="color: #222222; font-family: "arial" , sans-serif; font-weight: normal; line-height: normal;">This tutorial will go over how to download MS SQL Server data into Excel file. This is Very useful for generating Excel Reports of Php and </span></b><b style="background-color: white; color: #333333; font-family: Arial; font-size: small; line-height: 19.200000762939453px;"><span style="color: #222222; font-family: "arial" , sans-serif; font-weight: normal; line-height: normal;">MS SQL Server</span></b><b style="background-color: white; color: #333333; font-family: Arial; font-size: small; line-height: 19.200000762939453px;"><span style="color: #222222; font-family: "arial" , sans-serif; font-weight: normal; line-height: normal;"> Applications.</span> </b><br />
<br style="background-color: white; color: #333333; font-family: Arial; font-size: 12px; line-height: 19.200000762939453px;" />
<span style="background-color: white; color: #333333; font-family: "arial"; font-size: 12px; line-height: 19.200000762939453px;"><?php</span><br />
<span style="background-color: white; color: #333333; font-family: "arial"; font-size: 12px; line-height: 19.200000762939453px;">$myServer = "host_name";</span><br />
<span style="background-color: white; color: #333333; font-family: "arial"; font-size: 12px; line-height: 19.200000762939453px;">$myUser = "user_name";</span><br />
<span style="background-color: white; color: #333333; font-family: "arial"; font-size: 12px; line-height: 19.200000762939453px;">$myPass = "password";</span><br />
<span style="background-color: white; color: #333333; font-family: "arial"; font-size: 12px; line-height: 19.200000762939453px;">$myDB = "database_name";</span><br />
<br style="background-color: white; color: #333333; font-family: Arial; font-size: 12px; line-height: 19.200000762939453px;" />
<span style="background-color: white; color: #333333; font-family: "arial"; font-size: 12px; line-height: 19.200000762939453px;">//create an instance of the ADO connection object</span><br />
<span style="background-color: white; color: #333333; font-family: "arial"; font-size: 12px; line-height: 19.200000762939453px;">$conn = new COM ("ADODB.Connection") or die("Cannot start ADO");</span><br />
<br style="background-color: white; color: #333333; font-family: Arial; font-size: 12px; line-height: 19.200000762939453px;" />
<span style="background-color: white; color: #333333; font-family: "arial"; font-size: 12px; line-height: 19.200000762939453px;">//define connection string, specify database driver</span><br />
<span style="background-color: white; color: #333333; font-family: "arial"; font-size: 12px; line-height: 19.200000762939453px;">$connStr = "PROVIDER=SQLOLEDB;SERVER=".$myServer.";UID=".$myUser.";PWD=".$myPass.";DATABASE=".$myDB;</span><br />
<span style="background-color: white; color: #333333; font-family: "arial"; font-size: 12px; line-height: 19.200000762939453px;">$conn->open($connStr); //Open the connection to the database</span><br />
<br style="background-color: white; color: #333333; font-family: Arial; font-size: 12px; line-height: 19.200000762939453px;" />
<span style="background-color: white; color: #333333; font-family: "arial"; font-size: 12px; line-height: 19.200000762939453px;">//declare the SQL statement that will query the database</span><br />
<span style="background-color: white; color: #333333; font-family: "arial"; font-size: 12px; line-height: 19.200000762939453px;">$query = "SELECT col1, col2, col3, .... , coln FROM table_name";</span><br />
<br style="background-color: white; color: #333333; font-family: Arial; font-size: 12px; line-height: 19.200000762939453px;" />
<span style="background-color: white; color: #333333; font-family: "arial"; font-size: 12px; line-height: 19.200000762939453px;">//execute the SQL statement and return records</span><br />
<span style="background-color: white; color: #333333; font-family: "arial"; font-size: 12px; line-height: 19.200000762939453px;">$rs = $conn->execute($query);</span><br />
<br style="background-color: white; color: #333333; font-family: Arial; font-size: 12px; line-height: 19.200000762939453px;" />
<span style="background-color: white; color: #333333; font-family: "arial"; font-size: 12px; line-height: 19.200000762939453px;">$num_columns = $rs->Fields->Count();</span><br />
<span style="background-color: white; color: #333333; font-family: "arial"; font-size: 12px; line-height: 19.200000762939453px;">//echo "col:".$num_columns . "<br>";</span><br />
<br style="background-color: white; color: #333333; font-family: Arial; font-size: 12px; line-height: 19.200000762939453px;" />
<span style="background-color: white; color: #333333; font-family: "arial"; font-size: 12px; line-height: 19.200000762939453px;">for ($i=0; $i < $num_columns; $i++) {</span><br />
<span style="background-color: white; color: #333333; font-family: "arial"; font-size: 12px; line-height: 19.200000762939453px;"> $fld[$i] = $rs->Fields($i);</span><br />
<span style="background-color: white; color: #333333; font-family: "arial"; font-size: 12px; line-height: 19.200000762939453px;">}</span><br />
<br style="background-color: white; color: #333333; font-family: Arial; font-size: 12px; line-height: 19.200000762939453px;" />
<span style="background-color: white; color: #333333; font-family: "arial"; font-size: 12px; line-height: 19.200000762939453px;">$contents="<table border='1'>";</span><br />
<br style="background-color: white; color: #333333; font-family: Arial; font-size: 12px; line-height: 19.200000762939453px;" />
<span style="background-color: white; color: #333333; font-family: "arial"; font-size: 12px; line-height: 19.200000762939453px;">while (!$rs->EOF) //carry on looping through while there are records</span><br />
<span style="background-color: white; color: #333333; font-family: "arial"; font-size: 12px; line-height: 19.200000762939453px;">{</span><br />
<span style="background-color: white; color: #333333; font-family: "arial"; font-size: 12px; line-height: 19.200000762939453px;"> $contents.="<tr>";</span><br />
<span style="background-color: white; color: #333333; font-family: "arial"; font-size: 12px; line-height: 19.200000762939453px;"> for ($i=0; $i < $num_columns; $i++) {</span><br />
<span style="background-color: white; color: #333333; font-family: "arial"; font-size: 12px; line-height: 19.200000762939453px;"> $contents.="<td>" . $fld[$i]->value . "</td>";</span><br />
<span style="background-color: white; color: #333333; font-family: "arial"; font-size: 12px; line-height: 19.200000762939453px;"> }</span><br />
<span style="background-color: white; color: #333333; font-family: "arial"; font-size: 12px; line-height: 19.200000762939453px;"> $contents.="</tr>";</span><br />
<span style="background-color: white; color: #333333; font-family: "arial"; font-size: 12px; line-height: 19.200000762939453px;"> $rs->MoveNext(); //move on to the next record</span><br />
<span style="background-color: white; color: #333333; font-family: "arial"; font-size: 12px; line-height: 19.200000762939453px;">}</span><br />
<br style="background-color: white; color: #333333; font-family: Arial; font-size: 12px; line-height: 19.200000762939453px;" />
<span style="background-color: white; color: #333333; font-family: "arial"; font-size: 12px; line-height: 19.200000762939453px;">$contents.="</table>";</span><br />
<br style="background-color: white; color: #333333; font-family: Arial; font-size: 12px; line-height: 19.200000762939453px;" />
<span style="background-color: white; color: #333333; font-family: "arial"; font-size: 12px; line-height: 19.200000762939453px;">$file="File_name.xls";</span><br />
<span style="background-color: white; color: #333333; font-family: "arial"; font-size: 12px; line-height: 19.200000762939453px;">$test="<table border=1><tr><td>Cell 1</td><td>Cell 2</td></tr></table>";</span><br />
<span style="background-color: white; color: #333333; font-family: "arial"; font-size: 12px; line-height: 19.200000762939453px;">header("Content-type: application/vnd.ms-excel");</span><br />
<span style="background-color: white; color: #333333; font-family: "arial"; font-size: 12px; line-height: 19.200000762939453px;">header("Content-Disposition: attachment; filename=File_name".date('Y-m-d').".xls");</span><br />
<span style="background-color: white; color: #333333; font-family: "arial"; font-size: 12px; line-height: 19.200000762939453px;">echo $contents;</span><br />
<br style="background-color: white; color: #333333; font-family: Arial; font-size: 12px; line-height: 19.200000762939453px;" />
<span style="background-color: white; color: #333333; font-family: "arial"; font-size: 12px; line-height: 19.200000762939453px;">//close the connection and recordset objects freeing up resources</span><br />
<span style="background-color: white; color: #333333; font-family: "arial"; font-size: 12px; line-height: 19.200000762939453px;">$rs->Close();</span><br />
<span style="background-color: white; color: #333333; font-family: "arial"; font-size: 12px; line-height: 19.200000762939453px;">$conn->Close();</span><br />
<br style="background-color: white; color: #333333; font-family: Arial; font-size: 12px; line-height: 19.200000762939453px;" />
<span style="background-color: white; color: #333333; font-family: "arial"; font-size: 12px; line-height: 19.200000762939453px;">$rs = null;</span><br />
<span style="background-color: white; color: #333333; font-family: "arial"; font-size: 12px; line-height: 19.200000762939453px;">$conn = null;</span><br />
<span style="background-color: white; color: #333333; font-family: "arial"; font-size: 12px; line-height: 19.200000762939453px;">?></span></div>
kiranhttp://www.blogger.com/profile/02602195715866242058noreply@blogger.com2tag:blogger.com,1999:blog-3402343847615925802.post-41900432763957888362014-03-21T03:15:00.000-07:002017-03-15T12:34:48.756-07:00Display MS Sql Server Data using PHP<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5PMpLc7PWQ-brI8s9aRUEu5wKUtO44Yy9xSe8ZIVLK9Pfg6pQT5Qu_RXXwUxJ18VBNRZ72wGbzge1mmXOxWPlw2shnP1rsskJzdemdow_jLLL7JqgCznPPsHSbdyScNMjDD5vvESNo84/s1600/PHP-Logo-Free-Download-PNG.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="107" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5PMpLc7PWQ-brI8s9aRUEu5wKUtO44Yy9xSe8ZIVLK9Pfg6pQT5Qu_RXXwUxJ18VBNRZ72wGbzge1mmXOxWPlw2shnP1rsskJzdemdow_jLLL7JqgCznPPsHSbdyScNMjDD5vvESNo84/s200/PHP-Logo-Free-Download-PNG.png" width="200" /></a></div>
<b style="background-color: white; color: #333333; font-family: Arial; font-size: small; line-height: 19.200000762939453px;"><span style="color: #222222; font-family: "arial" , sans-serif; font-weight: normal; line-height: normal;"><br /></span></b>
<b style="background-color: white; color: #333333; font-family: Arial; font-size: small; line-height: 19.200000762939453px;"><span style="color: #222222; font-family: "arial" , sans-serif; font-weight: normal; line-height: normal;"><br /></span></b>
<b style="background-color: white; color: #333333; font-family: Arial; font-size: small; line-height: 19.200000762939453px;"><span style="color: #222222; font-family: "arial" , sans-serif; font-weight: normal; line-height: normal;">This tutorial will go over how to Display MS SQL Server datausing PHP.</span></b><br />
<b style="background-color: white; color: #333333; font-family: Arial; font-size: small; line-height: 19.200000762939453px;"><span style="color: #222222; font-family: "arial" , sans-serif; font-weight: normal; line-height: normal;"><br /></span></b>
<?php<br />
$myServer = "host_name";<br />
$myUser = "user_name";<br />
$myPass = "password";<br />
$myDB = "database_name";<br />
<br />
//create an instance of the ADO connection object<br />
$conn = new COM ("ADODB.Connection") or die("Cannot start ADO");<br />
<br />
//define connection string, specify database driver<br />
$connStr = "PROVIDER=SQLOLEDB;SERVER=".$myServer.";UID=".$myUser.";PWD=".$myPass.";DATABASE=".$myDB;<br />
$conn->open($connStr); //Open the connection to the database<br />
<br />
//declare the SQL statement that will query the database<br />
$query = "SELECT col1, col2, col3, .... , coln FROM table_name";<br />
<br />
//execute the SQL statement and return records<br />
$rs = $conn->execute($query);<br />
<br />
$num_columns = $rs->Fields->Count();<br />
//echo "col:".$num_columns . "<br>";<br />
<br />
for ($i=0; $i < $num_columns; $i++)<br />
{<br />
$fld[$i] = $rs->Fields($i);<br />
}<br />
<br />
echo "<table>";<br />
<br />
while (!$rs->EOF) //carry on looping through while there are records<br />
{<br />
echo "<tr>";<br />
for ($i=0; $i < $num_columns; $i++) {<br />
echo "<td>" . $fld[$i]->value . "</td>";<br />
}<br />
echo "</tr>";<br />
$rs->MoveNext(); //move on to the next record<br />
}<br />
<br />
echo "</table>";<br />
<br />
//close the connection and recordset objects freeing up resources<br />
$rs->Close();<br />
$conn->Close();<br />
<br />
$rs = null;<br />
$conn = null;<br />
?><br />
<br /></div>
kiranhttp://www.blogger.com/profile/02602195715866242058noreply@blogger.com0