File tree 5 files changed +46
-0
lines changed
basic/01_Request_Methods/01_Get
5 files changed +46
-0
lines changed Original file line number Diff line number Diff line change
1
+ /.idea
2
+ /vendor
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ curl --request GET " https://postman-echo.com/get?foo=bar" --max-time 10
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ $ curlHandler = curl_init ();
4
+
5
+ curl_setopt_array ($ curlHandler , [
6
+ CURLOPT_URL => 'https://postman-echo.com/get?foo=bar ' ,
7
+ CURLOPT_CONNECTTIMEOUT => 10 ,
8
+ CURLOPT_TIMEOUT => 10 ,
9
+ CURLOPT_RETURNTRANSFER => true ,
10
+ ]);
11
+
12
+ $ response = curl_exec ($ curlHandler );
13
+
14
+ curl_close ($ curlHandler );
15
+
16
+ echo ($ response );
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ require_once 'vendor/autoload.php ' ;
4
+
5
+ use GuzzleHttp \Client ;
6
+ use GuzzleHttp \RequestOptions ;
7
+
8
+ $ httpClient = new Client ([
9
+ RequestOptions::TIMEOUT => 10.0 ,
10
+ RequestOptions::CONNECT_TIMEOUT => 10.0 ,
11
+ ]);
12
+
13
+ $ response = $ httpClient ->get (
14
+ 'https://postman-echo.com/get ' ,
15
+ [
16
+ RequestOptions::QUERY => [
17
+ 'foo ' => 'bar ' ,
18
+ ],
19
+ ]
20
+ );
21
+
22
+ echo (
23
+ $ response ->getBody ()->getContents ()
24
+ );
Original file line number Diff line number Diff line change
1
+ GET https://postman-echo.com/get?foo=bar
You can’t perform that action at this time.
0 commit comments