Last active
October 16, 2019 18:58
-
-
Save spdin/bdd4228b71c6af2c9abb7503e20300c7 to your computer and use it in GitHub Desktop.
API end point request using PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| include 'config.php'; | |
| use GuzzleHttp\Client; | |
| require 'vendor/autoload.php'; | |
| $client = new Client(); | |
| $ip_api = 'http://35.202.12.206:8811/kk-json'; | |
| $myfile = fopen('kartukeluarga.jpg','rb'); | |
| $res = $client->post($ip_api, | |
| ['multipart' => [ | |
| [ | |
| 'name' => 'image', | |
| 'contents' => $myfile, | |
| 'filename' => 'data.jpg' | |
| ], | |
| ] | |
| ]); | |
| $array = json_decode($res->getBody(), true); | |
| echo '<pre>'; print_r($array['output']); echo '</pre>'; | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment