Title: Custom Fields
Last modified: August 20, 2016

---

# Custom Fields

 *  [bondigor69](https://wordpress.org/support/users/bondigor69/)
 * (@bondigor69)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/custom-fields-71/)
 * Hey guys I have this script that works well
 *     ```
       <?php
       //amazon api
   
       define('AWS_ACCESS_KEY_ID', 'AKrrIArJusgOV4ZWjghjhjUB2QSUL6KAjghj');
       define('AWS_SECRET_ACCESS_KEY', 'JzTISpVdghdfhdfhfdhdfhdfh8JxmRaVXmaJI8C4Izc9tEywCwk');
       define('AMAZON_ASSOC_TAG', 'chehdfhdhdfhdfh20');
   
       function amazon_get_signed_url($searchTerm) {
       $base_url = "http://ecs.amazonaws.com/onca/xml";
       $params = array(
       'AWSAccessKeyId' => AWS_ACCESS_KEY_ID,
       'AssociateTag' => AMAZON_ASSOC_TAG,
       'Version' => "2010-11-01",
       'Operation' => "ItemSearch",
       'Service' => "AWSECommerceService",
       'ResponseGroup' => "ItemAttributes,Images",
       'Availability' => "Available",
       'Condition' => "All",
       'Operation' => "ItemSearch",
       'SearchIndex' => 'All', //Change search index if required, you can also accept it as a parameter for the current method like $searchTerm
       'Keywords' => $searchTerm);
   
       //'ItemPage'=>"1",
       //'ResponseGroup'=>"Images,ItemAttributes,EditorialReview",
   
       if(empty($params['AssociateTag'])) {
       unset($params['AssociateTag']);
       }
   
       // Add the Timestamp
       $params['Timestamp'] = gmdate("Y-m-d\TH:i:s.\\\\\Z", time());
   
       // Sort the URL parameters
       $url_parts = array();
       foreach(array_keys($params) as $key)
       $url_parts[] = $key . "=" . str_replace('%7E', '~', rawurlencode($params[$key]));
       sort($url_parts);
   
       // Construct the string to sign
       $url_string = implode("&", $url_parts);
       $string_to_sign = "GET\necs.amazonaws.com\n/onca/xml\n" . $url_string;
   
       // Sign the request
       $signature = hash_hmac("sha256", $string_to_sign, AWS_SECRET_ACCESS_KEY, TRUE);
   
       // Base64 encode the signature and make it URL safe
       $signature = urlencode(base64_encode($signature));
   
       $url = $base_url . '?' . $url_string . "&Signature=" . $signature;
   
       return ($url);
       }
   
       ?>
       <?php
   
        $lcolor = 000 ;
        $web_rank = 'myid';
   
       $getthis = 'My keyword';
   
       $show = amazon_get_signed_url($getthis);
   
       $ch = curl_init($show);
       curl_setopt($ch, CURLOPT_HEADER, false);
       curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
       $c = curl_exec($ch);
   
       $xml = simplexml_load_string($c);
       $json = json_encode($xml);
       $array = json_decode($json,TRUE);
   
       $checkamazon = $array['Items']['Item'][0]['DetailPageURL'];
   
       if($checkamazon != ""){
       }
   
       for($i=0;$i<1;$i++){
   
       $aprice = $array['Items']['Item'][$i]['ItemAttributes']['ListPrice']['FormattedPrice'];
       $aDescription = $array['Items']['Item'][$i]['ItemAttributes']['Title'];
       $aUrl = $array['Items']['Item'][$i]['DetailPageURL'];
       $aImage = $array['Items']['Item'][$i]['SmallImage']['URL'];
   
       if($aUrl != ""){
       echo "<a href = \"$aUrl\" target='_blank' STYLE=\"TEXT-DECORATION: NONE;\">";
       echo "<img src='$aImage' ><p>$aDescription</p></a><br>";
   
       }
       }
   
       ?>
       ```
   
 * Everythin works well if in the $getthis variable I write an keyword.
    It echo’s
   the amazon product.
 * Now I’ve set up an custom field `<?php meta('Key1'); ?>`
 * I want the variable $getthis to be equal to this custom field
 * I tried
    `$gethis = meta('Key1');` dont work `$gethis = "meta('Key1')";` only
   echo the actual keyword that is set in the custom field
 * Please help

The topic ‘Custom Fields’ is closed to new replies.

## Tags

 * [custom field](https://wordpress.org/support/topic-tag/custom-field/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [bondigor69](https://wordpress.org/support/users/bondigor69/)
 * Last activity: [13 years, 3 months ago](https://wordpress.org/support/topic/custom-fields-71/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
