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. :(

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

×
×
  • 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.