Not able to process this error as I am getting this as my output enter code here
Notice: Trying to get property of non-object in C:\\xampp\\htdocs\\seo\\seo.php on line 161 Notice: Trying to get property of non-object in C:\\xampp\\htdocs\\seo\\seo.php on line 162
and
Notice:Trying to get property of non-object in C:\\xampp\\htdocs\\seo\\seo.php on line 163 Page Authority:0 Domain Authority:0 External Links:
and this is the code
$accessID = " xxxx ";
$secretKey = " xxxxxxxx";
$domain = "$sig";
$expire_in = time() + 500;
$SignIn = $accessID."n".$expire_in;
$binarySignature = hash_hmac('sha1', $SignIn, $secretKey, true);
$urlSafeSignature = urlencode(base64_encode($binarySignature));
$data = "103079215140";
$curlURL = "http://lsapi.seomoz.com/linkscape/url-metrics/?Cols=".$data."&AccessID=".$accessID."&Expires=".$expire_in."&Signature=".$urlSafeSignature;
$Domains = array($domain);
$Domai = json_encode($Domains);
$options = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => $Domai
);
$ch = curl_init($curlURL);
curl_setopt_array($ch, $options);
$response = curl_exec($ch);
curl_close( $ch );
$result = json_decode($response,true);
$pageAuthority=round($result[0]->upa,0);
$domainAuthority=round($result[0]->pda,0);
$externalLinks=$result[0]->ueid;
echo "Page Authority:".$pageAuthority."<br/>";
echo "Domain Authority:".$domainAuthority."<br/>";
echo "External Links:".$externalLinks."<br/>";
You are using:
$result = json_decode($response,true);
^^^^ here
According to the manual :
When TRUE, returned objects will be converted into associative arrays.
So the result will be an array and there will be no objects.
So you need:
$result[0]['upa']
// etc.
$result[0]
is probably not an object.
try using print_r to print the contents of that variable after json_decode.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.