array(
'method' => 'POST',
'content' => $data));
if ($optheaders !== null) {
$invar['http']['header'] = $optheaders;
}
$ctx = stream_context_create($invar);
$fp = @fopen($url, 'rb', false, $ctx);
if (!$fp) {
throw new Exception("Ссылка: ".$url."
;Ошибка: ".$php_errormsg);
}
$response = @stream_get_contents($fp);
if ($response === false) {
throw new Exception("Ссылка: ".$url."
;Ошибка чтения: ".$php_errormsg);
}
return $response;
}
?>