Mobile friendly or responsive website is now the most important feature of a website . Google is now giving more concentration on mobile friendly feature for their search rank. Recently google has closed the page rank of website for public. And they are recommending to optimize your site for mobile version.
In SEO , responsiveness of your site is a vital metrics. I am here is going to describe how you can check your site or your competitors site or any website is optimized for mobile version.
You can check it by browser easily. But I am not telling this option. I am discussing about programming and how you can check with program and all other valuable information about your site.
In our SiteSpy , we have implemented the google mobile ready API for collecting data. Google has the API named “PageSpeed Insight API”. This API returns all the metrics and image of your site for mobile version.
Let’s see the image, mobile ready check of of two sites by SiteSpy . First one is mobile friendly and scored 99 and second one is not mobile friendly and scored only 61. This is actually the evaluation by google.
Not Mobile Friendly
Now let’s go to the programming part. We just need a google API key. Getting a API key, just watch the video.
This code will give you a json response. Now your task is to process the json data and integrate with your application as you want.
$domain="ANY_WEBSITE"; /* http://mysitespy.net */
$ch = curl_init();
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible;)");
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_URL, $url); // set url to post to
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable
curl_setopt($ch, CURLOPT_TIMEOUT, 50); // times out after 50s
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
echo $content = curl_exec($ch); // run the whole process