Jump to content
Fórum Script Brasil
  • 0

erro objeto


felipepai
 Share

Question

Ola galera, estou com o seguinte problema, quero capturar a total_visits, esta dando um erro segue código:

ERRO: Notice: Trying to get property of non-object in /home/bigpr460/public_html/ml/php-sdk-master/examples/visitas.php on line 13
 

===================================

$result = $meli->get('https://api.mercadolibre.com/users/182402165/items_visits?date_from=2016-05-01T00:00:00.000-00:00&date_to=2016-05-13T00:00:00.000-00:00');
 
foreach ($result['body'] as $visitas):
    $tt = $visitas->total_visits;   <<<<<<<<---- estou fazendo assim( volta um erro)
    echo "total de visita".$tt."<br />";
endforeach;
 
echo '<pre>';
print_r($result);
echo '</pre>';
==================================================
 a função O print_r :
Array
(
[body] => stdClass Object
(
[user_id] => 182402165
[date_from] => 2016-05-01T00:00:00.000-00:00
[date_to] => 2016-05-13T00:00:00.000-00:00
[total_visits] => 10312
[visits_detail] => Array
(
[0] => stdClass Object
(
[company] => mercadolibre
[quantity] => 10312
)

)

)

[httpCode] => 200

)

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Forum Statistics

    • Total Topics
      149.9k
    • Total Posts
      646.8k
×
×
  • Create New...