Jump to content

Pulling from a stdClass Object google service


ydoisuck

Recommended Posts

Hi i'm struggling to pull data from an stdClass Object which searches google for an item.

 

This is the code that pulls out the information

 

 

<?php 

$encoded_response = file_get_contents("https://www.googleapis.com/shopping/search/v1/public/products?key=AIzaSyDCrZzoEB46bliROIn8JgOImm0B5YvxbVY&country=US&q=0014633144796"); 
$response = json_decode($encoded_response); 
print_r($response); 				


?> 

(can be seen at:http://www.rafoggin.com/Shrop/googletestapi.php

 

i've tried

$object = $result[0]; 
$print = $object->kind; 

echo $print

 

and

foreach ($result->product as $print) {
    echo $print->googleId;

and many other variations but can't get it to work.

 

ideally i'd like to pull the images out, but the structure confuses me. Your help is really appreciated, I can't figure this out. :(

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.