Created
February 22, 2012 17:10
-
-
Save libryder/1886121 to your computer and use it in GitHub Desktop.
Method to post to a rest service without cURL
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 | |
| $data = array ( | |
| "limit" => 5, | |
| "api_key" => 'YOUR_API_KEY', | |
| "api_secret" => 'YOUR_API_SECRET', | |
| ); | |
| $method = "getCallDetails"; | |
| $url = "https://api.logmycalls.com/services/$method"; | |
| $opts = array('http' => | |
| array( | |
| 'method' => 'POST', | |
| 'header' => "Accept: application/json\r\n" . "Content-Type: application/json\r\n", | |
| 'content' => json_encode($data) | |
| ) | |
| ); | |
| $context = stream_context_create($opts); | |
| $result = file_get_contents($url, false, $context); | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yeah it's working.