amuck-landowner

ODD Sharer Behavior

mainline.realty

New Member
Hello,


I am new here and I am hoping to get some answers and continue to use this forum for all my VPS issues; I have notices an odd behavior through my site over time and I think it's about time I took care of it; I have a VPS through WHM cPanel. Medium size package with 2 CPU Cores and 4GB RAM. About 300 Posts (WordPress Platform); I am using an Ok theme that is optimized actually and my score through gtmetrix is about 98% - 92% for yslow.


Here is my issue:


When I log in to my personal twitter and retweet my website tweets (Let's say about 10 of them) my VPS overloads immediately to 80% or more while it is under 1% any other times. Checking the logs through cPanel I noticed 1 (one) PHP file with "a lot" of queries and that is a sharrre.php - The only thing I can think of is maybe it is not optimized? The theme builder guy is a "no go" for this specific issue. I am attaching the code of that specific file so maybe you guys can help. I would REALLY appreciate it.


Sarah.

Code:
<?php
  header('content-type: application/json');
  //Sharrre by Julien Hany
  $json = array('url'=>'','count'=>0);
  $json['url'] = $_GET['url'];
  $url = isset(urlencode($_GET['url'])) ? $_GET['url'] ? '';
  $type = isset(urlencode($_GET['type'])) ? $_GET['type'] ? '';
  
  $ori_url = isset($_GET['url']) ? $_GET['url'] ? '';
    
  if(filter_var($ori_url, FILTER_VALIDATE_URL)){
    if($type == 'googlePlus'){  //source http://www.helmutgranda.com/2011/11/01/get-a-url-google-count-via-php/
      $contents = parse('https://plusone.google.com/u/0/_/+1/fastbutton?url=' . $url . '&count=true');

      preg_match( '/window\.__SSR = {c: ([\d]+)/', $contents, $matches );

      if(isset($matches[0])){
        $json['count'] = (int)str_replace('window.__SSR = {c: ', '', $matches[0]);
      }
    }
    else if($type == 'stumbleupon'){
      $content = parse("http://www.stumbleupon.com/services/1.01/badge.getinfo?url=$url");
      
      $result = json_decode($content);
      if (isset($result->result->views))
      {
          $json['count'] = $result->result->views;
      }

    }
  }
  echo str_replace('\\/','/',json_encode($json));
  
  function parse($encUrl){
    $options = array(
      CURLOPT_RETURNTRANSFER => true, // return web page
      CURLOPT_HEADER => false, // don't return headers
      CURLOPT_FOLLOWLOCATION => true, // follow redirects
      CURLOPT_ENCODING => "", // handle all encodings
      CURLOPT_USERAGENT => 'sharrre', // who am i
      CURLOPT_AUTOREFERER => true, // set referer on redirect
      CURLOPT_CONNECTTIMEOUT => 5, // timeout on connect
      CURLOPT_TIMEOUT => 10, // timeout on response
      CURLOPT_MAXREDIRS => 3, // stop after 10 redirects
      CURLOPT_SSL_VERIFYHOST => 0,
      CURLOPT_SSL_VERIFYPEER => false,
    );
    $ch = curl_init();
    
    $options[CURLOPT_URL] = $encUrl;  
    curl_setopt_array($ch, $options);
    
    $content = curl_exec($ch);
    $err = curl_errno($ch);
    $errmsg = curl_error($ch);
    
    curl_close($ch);
    
    if ($errmsg != '' || $err != '') {
      /*print_r($errmsg);
      print_r($errmsg);*/
    }
    return $content;
  }
 

DomainBop

Dormant VPSB Pathogen
The Sharre plugin hasn't been updated in over 2 years and is only compatible with WordPress versions up to 3.91.  If I had to make a guess I'd say one or more of the social networks included in the plugin changed their APIs and the plugin is hanging when it tries to submit to them which is what is causing the high loads
 

mainline.realty

New Member
Thank you so much for all the replies! Here is a list of the plugins I am using. I do not see a Sharre plugin!!! However, the file that is causing the issues under the framework is called: sharrre.php (See above for code).


Akismet


bbPress


BuddyPress


LayerSlider WP


Remove Query Strings from Static Resources


Revolution Slider


Stop Spammer Spam Control


Yoast SEO


WPBakery Visual Composer.


Sarah



 
 
Last edited by a moderator:
Top
amuck-landowner