File tree Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ require '../src/Curl/Curl.php ' ;
3
+
4
+ use \Curl \Curl ;
5
+
6
+ // curl \
7
+ // -X POST \
8
+ // -d "id=1&content=Hello+world%21&date=2015-06-30+19%3A42%3A21" \
9
+ // "https://httpbin.org/post"
10
+
11
+ $ data = array (
12
+ 'id ' => '1 ' ,
13
+ 'content ' => 'Hello world! ' ,
14
+ 'date ' => date ('Y-m-d H:i:s ' ),
15
+ );
16
+
17
+ $ curl = new Curl ();
18
+ $ curl ->post ('https://httpbin.org/post ' , $ data );
19
+ var_dump ($ curl ->response ->form );
Original file line number Diff line number Diff line change
1
+ <?php
2
+ require '../src/Curl/Curl.php ' ;
3
+
4
+ use \Curl \Curl ;
5
+
6
+ // curl \
7
+ // -X POST \
8
+ // -d "{"id":"1","content":"Hello world!","date":"2015-06-30 19:42:21"}" \
9
+ // "https://httpbin.org/post"
10
+
11
+ $ data = json_encode (array (
12
+ 'id ' => '1 ' ,
13
+ 'content ' => 'Hello world! ' ,
14
+ 'date ' => date ('Y-m-d H:i:s ' ),
15
+ ));
16
+
17
+ $ curl = new Curl ();
18
+ $ curl ->setHeader ('Content-Type ' , 'application/json ' );
19
+ $ curl ->post ('https://httpbin.org/post ' , $ data );
20
+ var_dump ($ curl ->response ->json );
You can’t perform that action at this time.
0 commit comments