1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| <?php
$url = "http://192.168.10.49:8080/signIn";
$params = array( "id" => 1, "name" => "Bob/Alice/桑迪" );
echo curlGet($url, $params);
function curlGet($url, $params, $timeout = 5) { if($url == "" || $timeout <= 0) { return ""; }
$url = $url.'?'.http_build_query($params); $con = curl_init((string)$url);
curl_setopt($con, CURLOPT_HEADER, false); curl_setopt($con, CURLOPT_RETURNTRANSFER,true); curl_setopt($con, CURLOPT_TIMEOUT, (int)$timeout); $result = curl_exec($con); curl_close($con);
echo $result; } ?>
|