<?php
// $ch = curl_init();
// curl_setopt($ch, CURLOPT_URL,"http://www.cricwaves.com/cricket/pics/c140x160/".$_GET['file']);
// curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
// //curl_setopt($ch, CURLOPT_PROXY,"localhost:8080");
// curl_setopt($ch, CURLOPT_REFERER, "http://www.cricwaves.com/mobile/");
// $data=curl_exec ($ch);
// curl_close ($ch);

// header("Content-Type: image/jpeg");
// echo $data;
require_once 'vendor/autoload.php';
    $request = new HTTP_Request2();
    $request->setUrl("http://www.cricwaves.com/cricket/pics/c140x160/".$_GET['file']);
    $request->setMethod(HTTP_Request2::METHOD_GET);
    $request->setConfig(array(
      'follow_redirects' => TRUE
    ));
    try {
      $response = $request->send();
      if ($response->getStatus() == 200) {
        echo  $response->getBody();
      }
      else {
        echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
        $response->getReasonPhrase();
      }
    }
    catch(HTTP_Request2_Exception $e) {
      echo 'Error: ' . $e->getMessage();
    }
?>