Код: Выделить всё
$options = array('http' => array(
'method' => 'POST',
'content' => $data,
'header' =>
"Content-Type: text/plain\r\n" .
"Content-Length: " . strlen($data) . "\r\n"
));
$context = stream_context_create($options);
$response = file_get_contents($url, false, $context);
Код: Выделить всё
file_get_contents(...): failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request
- подавить предупреждение (я планирую выдать собственное исключение в случае сбоя)
- получить информацию об ошибке (по крайней мере, код ответа) из потока
Подробнее здесь: https://stackoverflow.com/questions/156 ... ponse-code
Мобильная версия