jueves, 20 de agosto de 2015

Facebook Singup PHP

http://webtutsdepot.com/2009/12/19/facebook-api-tutorial-with-php/

http://www.krizna.com/general/login-with-facebook-using-php/

domingo, 9 de agosto de 2015

Guardando salida de un query en HTML

mysql  -H -e  " select * from asterisk.cdr limit 0,1" -p1234 > /var/www/cdr.html



Luego podemos acceder desde la web

http://75.11.118.23/cdr.html

id_callcalldateclidsrcdstdcontextchanneldstchannellastapplastdatadurationbillsecdispositionamaflagsaccountcodeuniqueiduserfieldunixtime
1385942015-04-11 02:10:52"919859582174" <919859582174>919859582174scontestSIP/con1-0000122aPlayback/var/lib/asterisk/sounds/contest/main11ANSWERED31428732652.139500

viernes, 7 de agosto de 2015

Algunas funciones de tiempo

Selecionando  la hora,  minuto y año de una fecha que esta en unix time

SELECT HOUR( FROM_UNIXTIME( cp_time ) ) , MINUTE( FROM_UNIXTIME( cp_time ) ) , YEAR( FROM_UNIXTIME( cp_time ) )
FROM `campaing`
LIMIT 0 , 30



SELECT * 
FROM `campaing`
WHERE HOUR( FROM_UNIXTIME( cp_time ) ) =16 and MINUTE( FROM_UNIXTIME( cp_time ) )>=01 and YEAR( FROM_UNIXTIME( cp_time ) )>=2015


SELECT FROM_UNIXTIME( cp_time )
FROM `campaing`
WHERE 1
LIMIT 0 , 30


2015-07-21 00:30:00
2015-08-02 16:02:00

MYSQL event

In this tutorial, you will learn about MySQL event scheduler and how to create MySQL events to automate database tasks.
A MySQL event is a task that runs based on a predefined schedule therefore sometimes it is referred to as a scheduled event. MySQL event is also known as “temporal trigger” because it is triggered by time, not by table update like a trigger. A MySQL event is similar to a cron job in UNIX or a task scheduler in Windows.
You can use MySQL events in many cases such as optimizing database tables, cleaning up logs, archiving data, or generate complex reports during off-peak time.

miércoles, 15 de julio de 2015

PHP whitepage API



root@asterisk-dominicana:~# php whitepage.php 2066013560


<?php
//$json = file_get_contents('http://proapi.whitepages.com/2.1/phone.json?phone=2066013560&api_key=3f9f57e7df15d5eea2ddd06ed88d4889');


$json = file_get_contents("http://proapi.whitepages.com/2.1/phone.json?phone=$argv[1]&api_key=3f9f57e7df15d5eea2ddd06ed88d4889");

$data = json_decode($json,true);



//print_r($data['results'][0]['belongs_to'][0]);


//var_dump($data['results'][0]['belongs_to'][0]);
echo "Customer Name : ".$data['results'][0]['belongs_to'][0]['best_name'];
echo "<br>";
echo "Customer Reputation ".$data['results'][0]['reputation']['level'];

exit;
?>

lunes, 25 de mayo de 2015

Explode() examples

array str_split ( string $string [, int $split_length = 1 ] )

Example #1 explode() examples
<?php// Example 1$pizza  = "piece1 piece2 piece3 piece4 piece5 piece6";$pieces = explode(" ", $pizza);
echo 
$pieces[0]; // piece1echo $pieces[1]; // piece2

// Example 2
$data = "foo:*:1023:1000::/home/foo:/bin/sh";
list(
$user, $pass, $uid, $gid, $gecos, $home, $shell) = explode(":", $data);
echo 
$user; // fooecho $pass; // *?>
Example #2 explode() return examples
<?php/*
   A string that doesn't contain the delimiter will simply
   return a one-length array of the original string.
*/
$input1 = "hello";$input2 = "hello,there";var_dump( explode( ',', $input1 ) );var_dump( explode( ',', $input2 ) );?>
The above example will output:
array(1)
(
    [0] => string(5) "hello"
)
array(2)
(
    [0] => string(5) "hello"
    [1] => string(5) "there"
)
Example #3 limit parameter examples
<?php
$str 
= 'one|two|three|four';// positive limitprint_r(explode('|', $str, 2));// negative limit (since PHP 5.1)print_r(explode('|', $str, -1));?>
The above example will output:
Array
(
    [0] => one
    [1] => two|three|four
)
Array
(
    [0] => one
    [1] => two
    [2] => three
)

sábado, 23 de mayo de 2015

Substrayendo valores substr

cadena







<?

$result="0411 2 Up Dial SIP/callcentric/411,,Tt 0154 00:00:24 5061874a-712b-44a9-9 ";

echo substr("$result",-60); //00:00:24 5061874a-712b-44a9-9

echo "<br><br>";

echo substr(substr("$result",-60),0,30);  //00:00:24

?>