コード例 #1
0
ファイル: OngkirCtrl.php プロジェクト: udibagas/lara-shop
 private function curl_get_content($url, $method = '', $postdata = '')
 {
     $curl = curl_init();
     if ($method == 'POST') {
         curl_setopt_array($curl, array(CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => $postdata, CURLOPT_HTTPHEADER => array("content-type: application/x-www-form-urlencoded", "key: " . shipOption('rajaongkir_key'))));
     } else {
         curl_setopt_array($curl, array(CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_HTTPHEADER => array("key: " . shipOption('rajaongkir_key'))));
     }
     $response = curl_exec($curl);
     $err = curl_error($curl);
     curl_close($curl);
     if ($err) {
         return "cURL Error #:" . $err;
     } else {
         return $response;
     }
 }
コード例 #2
0
ファイル: PageCtrl.php プロジェクト: udibagas/lara-shop
 public function checkout()
 {
     //        dd(Request::all());
     $this->data['ship_method'] = shipOption('shipping_method');
     return view('front.eshopper.pages.cart', $this->data);
 }