Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once('php/agk-libs.php');
- require_once('style/style.php');
- error_reporting(0);
- ini_set("display_errors", 0);
- if(isset($search)) {
- require_once('agk-api.php');
- $ServiceRootURL = 'https://api.datamarket.azure.com/Bing/Search/';
- $count = 18;//total list
- $skip = 0; //for paged
- $WebSearchURL = $ServiceRootURL . 'Image?$format=json&$top=' . $count . '&$skip=' . $skip . '&Query=';
- $context = stream_context_create(array(
- 'http' => array(
- 'request_fulluri' => true,
- 'header' => "Authorization: Basic " . base64_encode($accountKey . ":" . $accountKey)
- )
- ));
- $request = $WebSearchURL . urlencode( '\'' . $search. '\'');
- $response = file_get_contents($request, 0, $context);
- $jsonobj = json_decode($response);
- // echo $query;
- // highlight_string(print_r($jsonobj,true));
- ?>
- <div class="agk-container">
- <div class="agk-row">
- <?php
- foreach($jsonobj->d->results as $value) {
- $ANU = $value->MediaUrl;
- $imglink = str_ireplace(array("http://",".jpg"), "", $ANU);
- //echo $ANU;
- ?>
- <div class="agk-col-sm-6">
- <div class="zanel zanel-primary">
- <div class="zanel-heading">
- <h2 style="margin:0;padding:0;font-size:14px;font-weight:500;color: white;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;"><?php echo strtoupper($value->Title);?></h2>
- </div>
- <div class="zanel-body">
- <img height="200px" src="<?php echo $ANU;?>" class="img-responsive" style="width:100%;height:200px" title="<?php echo $value->Title;?>" alt="<?php echo $value->Title;?>">
- </a>
- </div>
- <div class="zanel-footer" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis"><center><a href="/lihat?lihat=<?php echo url_slug($value->Title);?>" title="Size : <?php echo KByteSize($value->FileSize);?>"><h4>Download HD</h4></center></a></div>
- </div>
- </div>
- <?php } //end foreach ?>
- </div>
- </div>
- <?php } // end
- //function to convert file size image
- function KByteSize($bytes) {
- $size = $bytes / 1024;
- if($size < 1024)
- {
- $size = number_format($size, 2);
- $size .= ' KB';
- }
- else
- {
- if($size / 1024 < 1024)
- {
- $size = number_format($size / 1024, 2);
- $size .= ' MB';
- }
- else if ($size / 1024 / 1024 < 1024)
- {
- $size = number_format($size / 1024 / 1024, 2);
- $size .= ' GB';
- }
- }
- return $size;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement