How Can I Write Logs Directly to AWS S3 in Nodejs?
Here is the code in which you can directly work with AWS S3 Logs.// need to install "npm install aws-sdk" first if not existconst AWS = require('aws-sdk')const s3 = new AWS.S3({ // your S3 accessKeyId and your S3 secretAccessKey accessKeyId: process.env.ACCESS_KEY_ID.trim(), secretAccessKey: process.env.SECRET_ACCESS_KEY.trim()})//...
Site improvement code.. have to put in htaccess
<IfModule mod_deflate.c>
# Compress HTML, CSS, JavaScript, Text, XML and fonts
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
...
set cookie value in javascript and displaying it with php
Set in javascript
document.cookie='fcookie='+tempo;
Get in PHP
if (isset($_COOKIE["fcookie"]))
echo $_COOKIE["fcookie"];
else
echo "Cookie Not Set"...
how to use in_array in smarty
in_array in smarty
{if $variable|in_array:[14, 15, 18]}
... Your code
{/if}
Or
in_array in smarty
{if $variable|in_array:$array}
... Your code
{/if}
...
Convert PDF to Text in PHP
<?php
function pdf2string($sourcefile) {
$fp = fopen($sourcefile, 'rb');
$content = fread($fp, filesize($sourcefile));
fclose($fp);
$searchstart = 'stream';
$searchend = 'endstream';
$pdfText = '';
$pos = 0;
$pos2 = 0;
$startpos = 0;
while ($pos !== false && $pos2 !== false) {
$pos = strpos($content, $searchstart, $startpos);
$pos2 = strpos($content,...
php curl request
function makeCURLRequest($url, $method="GET", $params = "") {
if ($method == "GET" && strpos($url, '?')) {
$urlParams = substr($url, strpos($url, '?')+1);
$url = substr($url, 0, strpos($url, '?'));
if (is_array($params))...
Subscribe to:
Posts
(
Atom
)