Calcetines Extreme

Calcetines Extreme
Take care of you using the best socks

Saturday, May 23, 2015

Adding #Charts to a website using javascrip with DataBase connection

You have some data in your DataBase that you would like to explode with Charts to offer Analytics solution to your visitors.

One simple way is to use highcharts, a company that has a collection of utilities to paint Charts using a simple script and of course with data base connecction and much more.

$dbcon = mysql_connect("localhost", "bartolo", "******");
mysql_select_db("DATABASE", $dbcon);
$result = mysql_query("SELECT * FROM table");
while ($row = mysql_fetch_array($result)) {
   $data[] = "['".$row['name']."',".$row['tot']."]";

$(function () {
        chart: {
            type: 'pie',
            options3d: { enabled: true, alpha: 45, beta: 0 }
        title: { text: 'Chosse the best Broker' },
        tooltip: {
            pointFormat: '{}: <b>{point.percentage:.1f}%</b>'
        plotOptions: {
            pie: {  allowPointSelect: true, cursor: 'pointer', depth: 35,
                dataLabels: { enabled: true, format: '{}' }}
        series: [{
            type: 'pie',             name: 'Browser share',
            data: [  <?php echo join($data, ','); ?> ]



Wednesday, May 13, 2015

Web Scraper

$request_url ='';

// The Regular Expression filter
 $reg_exUrl = "/(http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/";

 function get_domain($url)
  $pieces = parse_url($url);
  $domain = isset($pieces['host']) ? $pieces['host'] : '';
  if (preg_match('/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i', $domain, $regs)) {
   return $regs['domain'];
  return false;

 $ch = curl_init();
 curl_setopt($ch, CURLOPT_URL, $request_url); // The url to get links from

 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // We want to get the respone

 $result = curl_exec($ch);

 $title = preg_match('/title="(.+)">/', $html, $match);

 foreach($links as $link){
  $pos = strpos($link, '://');
  $exclude = strpos($link, 'google');  //remove google own results

  if ($pos!=0 && $exclude==0){
    $posini = strpos($link, 'http');
    $link = substr($link, $posini);
    echo "<a href='".$link."'>".get_domain($link)."</a> -> ".$link."<br>";




Friday, May 1, 2015

Update joomla metada keywords from MySQL 'update' query


You are too lazy to update keywords from article manager in the backend, and need a quick option to do that without installing any random plugin that do that for you (I found that plugins don't works as you except).


Go to MySQL administrator page and open your SQL windows to write a new SQL query to update your keywords, the joomla table / field where are stored meta about SEO keywords is _content , and the fieldname is "metakey".
Now with that you only need to run that sample SQL query to update SEO keywords.

SQL Query:
UPDATE *_content SET metakey = 'keyword1,'keyword2,'keyword3,'keyword4,'keyword5'
*Take careful that this query will update all your articles, if you would like to make some filter remember to use SQL conditions like WHERE id=x...