كود:
01function curl_post($url, array $post = NULL, array $options = array())02{
03    $defaults = array(
04        CURLOPT_POST => 1,
05        CURLOPT_HEADER => 0,
06        CURLOPT_URL => $url,
07        CURLOPT_FRESH_CONNECT => 1,
08        CURLOPT_RETURNTRANSFER => 1,
09        CURLOPT_FORBID_REUSE => 1,
10        CURLOPT_TIMEOUT => 4,
11        CURLOPT_POSTFIELDS => http_build_query($post)
12    );
13 
14    $ch = curl_init();
15    curl_setopt_array($ch, ($options + $defaults));
16    if( ! $result = curl_exec($ch))
17    {
18        trigger_error(curl_error($ch));
19    }
20    curl_close($ch);
21    return $result;
22}