Hi everybody! I'm new to php and have zero exprience with the cake-php. I created the php web services, which reads data from MySql and return to my iphone app. Previously I used the same code successfully in many app, But now I'm facing the problems in it. Because the web server on which I installed my web services is cake-php based. while my web services are written in simple php. I'm failing to get the data from them in my iphone app. Web services are working perfectly on localhost. but as Installed them on the server, I'm receiving binary data instead of xml file. I changed the encoding and content-type tag. Doing this web services returning the following fault code. error in msg parsing: Charset from HTTP Content-Type 'US-ASCII' does not match encoding from XML declaration 'utf-8'
So anyone can help me? Did I need to rewrite all of my web services in cake php or simple php web services can work?
by the way here is the code of one of my web service.
<?php
include('vp-config.php');
// Pull in the NuSOAP code
require_once('lib/nusoap.php');
define("PATH_DIR",str_replace("\\","/",dirname(__FILE__))."/");
$server = new soap_server;
$server->register('getAllNews');
function getAllNews($page) {
$conn = mysql_connect(DB_HOST,DB_USER,DB_PASSWORD);
mysql_select_db(DB_NAME, $conn) or die(mysql_error());
$q = "SELECT
`website_contents`.`id`,
`website_contents` .`website_top_category_id`,
`website_contents` .`created`,
`website_contents` .`short_description`
FROM `website_contents`
WHERE `website_contents`.`website_content_type_id` = 2
AND `website_contents` .`short_description` IS NOT NULL
ORDER BY id DESC LIMIT " . $page ." , 30";
$rs = mysql_query($q);
while($r = mysql_fetch_array($rs)){
$items[] = array('id'=>$r['id'],
'website_top_category_id'=>$r['website_top_category_id'],
'created'=>$r['created'],
'short_description'=>$r['short_description']
);
}
return $items;
}
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$serve
r->service($HTTP_RAW_POST_DATA);
Thanks in advance.