/ Published in: PHP

This function dosen't use curl, or any other libraries. Just include it in your function library and use it like this:
$Post_result = _post('http://www.yourdomain.com/your_path/post_api.php',"method=fetchJson¶ms=select * from user");
$Post_result = _post('http://www.yourdomain.com/your_path/post_api.php',"method=fetchJson¶ms=select * from user");
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function _post($url, $data, $optional_headers = null) { 'method' => 'POST', 'content' => $data )); if ($optional_headers !== null) { $params['http']['header'] = $optional_headers; } if (!$fp) { throw new Exception("Problem with $url, $php_errormsg"); } if ($response === false) { throw new Exception("Problem reading data from $url, $php_errormsg"); } return $response; }
Comments
