Created
April 18, 2016 05:03
-
-
Save aoeuidht/e1cef58c7db6905c12a24f0ae50b6210 to your computer and use it in GitHub Desktop.
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
| function request_es($param, $use_post=false) | |
| { | |
| /* send request to es */ | |
| $es_server = ''; | |
| $ch = curl_init($es_server); | |
| curl_setopt_array( | |
| $ch, | |
| array(CURLOPT_POST => TRUE, | |
| CURLOPT_RETURNTRANSFER => TRUE, | |
| CURLOPT_HTTPHEADER => array( | |
| 'Content-Type: application/json' | |
| ), | |
| CURLOPT_POSTFIELDS => json_encode($param) | |
| )); | |
| $resp = curl_exec($ch); | |
| if ($resp === false) | |
| { | |
| return null; | |
| } | |
| return json_decode($resp, true); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment