Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sometimes Data is not Showing #34

Open
DonPramis opened this issue Oct 28, 2017 · 0 comments
Open

Sometimes Data is not Showing #34

DonPramis opened this issue Oct 28, 2017 · 0 comments

Comments

@DonPramis
Copy link

DonPramis commented Oct 28, 2017

Hi, Sometimes the data are not showing. for (page authority,dmoz rank) i need to re do the test/ then it will come up:

Here is my code:

	/* Get SEOmoz Data
	-------------------------------------------------- */
		public function getSeoMoz($domain, $accessid = "", $secret = "")
		{
			try
			{
				$access_id = (empty($accessid) ? $_SESSION['SEOMOZ_API_ACCESSID'] : $accessid);
				$secret_key = (empty($secret) ? $_SESSION['SEOMOZ_API_SECRETKEY'] : $secret);
                                $expires = time() + 5000;
				$stringToSign = $access_id."\n".$expires;
				$binarySignature = hash_hmac('sha1', $stringToSign, $secret_key, true);
				$urlSafeSignature = base64_encode($binarySignature);

			$callback_url = "http://lsapi.seomoz.com/linkscape/url-metrics/www." . $domain . "?";
				$data = array(
					'Cols'		=> '68719493120',
					'AccessID'	=> $access_id,
					'Expires'	       => $expires,
					'Signature'	=> $urlSafeSignature
				);

				$curl_response = $this->curl->get($callback_url . http_build_query($data, '', '&'));

				if ($curl_response->headers['Status-Code'] == "200") {
					$parse_response = json_decode($curl_response, true);
					$domain_authority = $parse_response['pda'];
                                        $mozrank = $parse_response['umrp'];

                    $response = array(
						'status' => 'success',
						'data' => array(
						'domain_authority' => (int)round($domain_authority),
                                                'mozrank' => (int)round($mozrank)
						)
					);
                                        } else {
                                                   $response = array(
						        'status' => 'error',
						           'msg' => 'SEOMoZ Response Error.'
					);
                                      }
			            }
			  catch (Exception $e)
			                              {
				                       $response = array(
					                     'status' => 'error',
					                        'msg' => $e->getMessage()
				                        );
			         }
			return $response;		
		}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant