Jump to content

ydoisuck

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ydoisuck's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. yh no worries, I worked it out i was being a bit dumb. For those who didn't know (can't imagine there are a lot of you) it was: echo '<img src="images/yourimage.jpg" />';
  2. How do i display an image from my directory?!? :S I don't mean to be lazy and just ask people on here, I have researched it online but can't seem to find a quick simple answer. Thanks People!!
  3. Hi, I'm trying to resize an I'm from google product search, there's lots of code on the web but I don't know how to use it when i'm pulling an image from a json script. the script structure can be seen here.http://www.rafoggin.com/Shrop/googletestapi.php and my script to pull this info is: //Google API $response = file_get_contents("https://www.googleapis.com/shopping/search/v1/public/products?key=AIzaSyDCrZzoEB46bliROIn8JgOImm0B5YvxbVY&country=US&q=$upc"); $object = json_decode($response); echo '<p class="green"> success </p>'; echo '<p> Found on <b>Google Shopping</b></p>'; foreach($object->items as $item) { foreach($item->product->images as $image) { echo '<img src="'.$image->link.'" />'; } echo '<br/><p><b>Title: </b>'.$item->product->title.'</p>'; echo '<p class="barcode"> GTIN Code: '.$item->product->gtin.'</p><br/>'; foreach($item->product->inventories as $inventory) { echo '<p class="price">Price: '.$inventory->price.' '.$inventory->currency.'</p><br/>'; } echo '<p><b>Description: </b>'.$item->product->description.'</p>'; //echo '<p>Link:'.$item->product->link.'</p>'; echo '<hr/>'; Please help me!!!!
  4. 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.
  5. Hey, I'm trying to get this code to work...its a barcode decoder works ok if u enter a 12 digit code but if u enter an 8 or 13 digit EAN or UPC-A it doesn't so i've tried to change it so it reverts to 12 digits each time, only thing is i can't get it to work fluidly and I don't really understand it. Any help would be much appreciated! THANKS GUYS! <?php extract($_GET); if(isset($upc)) { ?> <form method="get" action="<?php print $_SERVER[php_SELF]; ?>"> <p><input type="text" name="upc" value=""/></p> <p><input type="submit" value="Search"/></p> </form> <?php require_once 'XML/RPC.php'; $rpc_key = 'c737eb5b608f31e5fa022718860f1578cf2cc2a6'; // Set your rpc_key here // Setup the URL of the XML-RPC service $client = new XML_RPC_Client('/xmlrpc', 'http://www.upcdatabase.com'); // Construct the entire parameter list (an array) for the call. // The array contains a single XML_RPC_Value object, a struct. // The struct is constructed from a PHP associative array, and each // value needs to be an XML_RPC_Value object. //convert the string length to 12 $upc = str_pad(ltrim($upc,'0'), 12, '0', STR_PAD_LEFT); $params = array( new XML_RPC_Value( array( 'rpc_key' => new XML_RPC_Value($rpc_key, 'string'), 'upc' => new XML_RPC_Value($_REQUEST['upc'], 'string'), ), 'struct')); // Construct the XML-RPC request. Substitute your chosen method name $msg = new XML_RPC_Message('lookup', $params); //Actually have the client send the message to the server. Save response. $resp = $client->send($msg); //If there was a problem sending the message, the resp will be false if (!$resp) { //print the error code from the client and exit echo 'Communication error: ' . $client->errstr; exit; } //If the response doesn't have a fault code, show the response as the array it is if(!$resp->faultCode()) { //Store the value of the response in a variable $val = $resp->value(); //Decode the value, into an array. $data = XML_RPC_decode($val); //Optionally print the array to the screen to inspect the values echo "<pre>" . print_r($data, true) . "</pre>"; echo '<p>'.$data['status'].'</p>'; echo '<p>'.$data['upc'].'</p>'; echo '<p>'.$data['description'].'</p>'; }else{ //If something went wrong, show the error echo 'Fault Code: ' . $resp->faultCode() . "\n"; echo 'Fault Reason: ' . $resp->faultString() . "\n"; } } ?> <p>Enter a 12 digit UPC Barcode</p> <form method="get" action="<?php print $_SERVER[php_SELF]; ?>"> <p><input type="text" name="upc" value=""/></p> <p><input type="submit" value="Search"/></p> </form>
  6. WOW Thanks sasa...that's crazy! i don't know how that works..but it does. Only think now is, that prints it out, any idea's how I would integrate into the API. ...I'm still amazed that works! haha amazing!
  7. Hi, I'm trying to run an api from upcdatabase.com. I works fine but some barcodes are 8digits or 13digits, i need those barcodes to be changed by adding in zero's if 8 or subtracting 1 zero if 13. It needs to do this before being sent to the sever. Your help is really appreciated this should be simple but has got be stumped i don't know where to even put the code... here's what i've got so far. THANKYOOUUU FOR YOUR TIME! <?php extract($_GET); if(isset($upc)) { ?> <form method="get" action="<?php print $_SERVER[php_SELF]; ?>"> <p><input type="text" name="upc" value=""/></p> <p><input type="submit" value="Search"/></p> </form> <?php require_once 'XML/RPC.php'; $rpc_key = 'c737eb5b608f31e5fa022718860f1578cf2cc2a6'; // Set your rpc_key here // Setup the URL of the XML-RPC service $client = new XML_RPC_Client('/xmlrpc', 'http://www.upcdatabase.com'); // Construct the entire parameter list (an array) for the call. // The array contains a single XML_RPC_Value object, a struct. // The struct is constructed from a PHP associative array, and each // value needs to be an XML_RPC_Value object. $params = array( new XML_RPC_Value( array( 'rpc_key' => new XML_RPC_Value($rpc_key, 'string'), 'upc' => new XML_RPC_Value($_REQUEST['upc'], 'string'), ), 'struct')); // Construct the XML-RPC request. Substitute your chosen method name $msg = new XML_RPC_Message('lookup', $params); $upc_count = count($upc); If ($upc_count == 7){ echo '0000'.$upc; } elseif ($upc == 13) { echo '000'.$upc; } else { echo 'incorrect number of digits'; } //Actually have the client send the message to the server. Save response. $resp = $client->send($msg); //If there was a problem sending the message, the resp will be false if (!$resp) { //print the error code from the client and exit echo 'Communication error: ' . $client->errstr; exit; } //If the response doesn't have a fault code, show the response as the array it is if(!$resp->faultCode()) { //Store the value of the response in a variable $val = $resp->value(); //Decode the value, into an array. $data = XML_RPC_decode($val); //Optionally print the array to the screen to inspect the values echo "<pre>" . print_r($data, true) . "</pre>"; echo '<p>'.$data['status'].'</p>'; echo '<p>'.$data['upc'].'</p>'; echo '<p>'.$data['description'].'</p>'; }else{ //If something went wrong, show the error echo 'Fault Code: ' . $resp->faultCode() . "\n"; echo 'Fault Reason: ' . $resp->faultString() . "\n"; } } else { ?> <p>Enter a 12 digit UPC Barcode</p> <form method="get" action="<?php print $_SERVER[php_SELF]; ?>"> <p><input type="text" name="upc" value=""/></p> <p><input type="submit" value="Search"/></p> </form>
×
×
  • 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.