Cannot Modify Header Information - Headers Already Sent In ...

I am posting XML data by using code below:



$response = Http::post("http://webservices.suratkargo.com.tr/services.asmx", $post_data, array( 'headers' => array('Content-type: text/xml')));




But I get this error below:

error_log:

[quote]

[18-Jun-2015 17:37:32 UTC] PHP Warning: Cannot modify header information - headers already sent in C:\wamp\www\app\functions\fn.control.php on line 498



[18-Jun-2015 17:37:32 UTC] PHP Stack trace:



[18-Jun-2015 17:37:32 UTC] PHP 1. {main}() C:\wamp\www\admin.php:0



[18-Jun-2015 17:37:32 UTC] PHP 2. fn_dispatch() C:\wamp\www\admin.php:27



[18-Jun-2015 17:37:32 UTC] PHP 3. header() C:\wamp\www\app\functions\fn.control.php:498



[/quote]



Why am I getting this? What is the solution?

hi,



possibly there is a php notice or warning and it causes the error.

have you checked line 498 in app/functions/fn.control.php ?



best regards,

WSA team

Yes. here is the code part:



if ($status == CONTROLLER_STATUS_NO_PAGE) {
if ($area == 'A' && empty($_SESSION['auth']['user_id'])) {
// If admin is not logged in redirect to login page from not found page
fn_set_notification('W', __('page_not_found'), __('page_not_found_text'));
fn_redirect("auth.login_form");
}
header(' ', true, 404);
}




In line 498 is:


header(' ', true, 404);




Using MV 4.2.4 ver.

Try to add the following line after your code:



fn_print_die($response);




Do you receive error messages in this case?

I am getting same error in a other request:



$post_data = '




';
fn_print_r($post_data);
$response = Http::post("https://api.n11.com/ws/CategoryService.wsdl", $post_data, array( 'headers' => array('Content-type: text/xml')));
fn_print_r($response);




the error:











ns0:ServernullParam
PHP Warning
Message
Cannot modify header information - headers already sent by (output started at C:\wamp\www\app\functions\fn.common.php:1425)
Error at
C:\wamp\www\app\functions\fn.control.php, line: 589
Backtrace
File: C:\wamp\www\app\functions\fn.control.php
Line: 589
Function: {closure}
File: C:\wamp\www\admin.php
Line: 27
Function: fn_dispatch