post( URL_TO_SEND_DATA, [ 'headers' => ['Content-Type' => 'application/json'], 'body' => json_encode($dataToBot) ]); //return $response; } } // Create the http client public static function startOptimizeImages($sourceBucket,$pdid) { include_once APPPATH.'/vendor/autoload.php'; //echo IMAGE_OPTIMIZE_LAMBDA_URL;//die(); if(true) { $reqest_data = ['bucket' => $sourceBucket,'pdid' => ('pd' . $pdid)]; //echo json_encode($reqest_data);die(); $client = new \GuzzleHttp\Client(); $response = $client->post( IMAGE_OPTIMIZE_LAMBDA_URL, [ 'headers' => ['Content-Type' => 'application/json'], 'body' => json_encode($reqest_data) ]); //print_r($response); $code = $response->getStatusCode(); $data = $response->getBody()->getContents(); //echo ($data);die(); return array('statusCode' => $code,'body' => $data); } } } ?>