note 95735 deleted from httpresponse.send by sobak

From: Date: Sun, 04 Dec 2016 07:28:03 +0000
Subject: note 95735 deleted from httpresponse.send by sobak
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-208125@lists.php.net to get a copy of this message
Note Submitter: lymber ---- how to respond to a http request Note that if you output data before sending the response then you will get a warning saying: Cannot modify header information - headers already sent. So do not echo any data in your responding script. <?php //process the request by fetching the info $headers = http_get_request_headers(); $result = http_get_request_body(); //do stuff with the $headers and $result variables.... //then send your response HttpResponse::status(200); HttpResponse::setContentType('text/xml'); HttpResponse::setHeader('From', 'Lymber'); HttpResponse::setData('<?xml version="1.0"?><note>Thank you for posting your data! We love php!</note>'); HttpResponse::send(); ?>

« previous php.notes (#208125) next »