Created
May 22, 2014 07:51
-
-
Save okiwan/5d5fb13cc616ae83e095 to your computer and use it in GitHub Desktop.
POST request with PHP Curl
This file contains 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 = file_get_contents('/Users/socana/Desktop/request.txt'); | |
$rsc = curl_init(); | |
curl_setopt($rsc, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); | |
curl_setopt($rsc, CURLOPT_URL, "http://demo.optimizr.eu:8080/OptimizrAnalysis/analyze"); | |
curl_setopt($rsc, CURLOPT_POST, true); | |
curl_setopt($rsc, CURLOPT_POSTFIELDS, $data); | |
curl_setopt($rsc, CURLOPT_RETURNTRANSFER, true); | |
$result = curl_exec($rsc); | |
curl_close($rsc); | |
print_r(json_decode($result)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment