Last active
August 29, 2015 14:18
-
-
Save AnowarCST/0a0cbb5d4c1dccf16bc3 to your computer and use it in GitHub Desktop.
Using Curl in PHP
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 | |
// header('Content-Type: application/xml; charset=utf-8'); | |
// header('Content-Type: application/json'); | |
// Page Name : index.php | |
$params = array( | |
"apiKey" => "30aNowar50Hossain42", | |
"User" => "anowar", | |
"token" => "1001", | |
"student" => "anowar", | |
"roll" => "305042", | |
"dept" => "CST", | |
"mobile" => "01822141954" | |
); | |
$ch = curl_init(); | |
$curlConfig = array( | |
CURLOPT_URL => "http://localhost/API_Rnd/myTestAPI.php/apiKey", | |
CURLOPT_POST => true, | |
CURLOPT_RETURNTRANSFER => true, | |
CURLOPT_POSTFIELDS => $params | |
); | |
curl_setopt_array($ch, $curlConfig); | |
$result = curl_exec($ch); | |
echo $result; | |
curl_close($ch); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment