tracivia Posted March 17, 2009 Share Posted March 17, 2009 Hi everybody, first i like to mention, i might be forgotten to provide enough information or misunderstood the needed information. I have a PHP scripts which gets an XML feed from an external service. The feed comes with slashes and i use stripslashes function to remove slashes. When i use the script with and local XML file, it works perfect. When i use the external service with stripslashes($_POST['data']), i am having troubles sometimes. %80 of the feed is fetched correctly tough. I don't use any ini set, magic quotes set on, and magic sybase is off. Server is Debian and my local pc is windows. It works perfect on both servers in case i don't use stripslashes. what could be the problem? Thanks in advance. P.S. i've analyzed this problem and just removing stripslashes solves the problem. $xml_str = stripslashes(trim($_POST['data'])); //doesn't work $xml_str = file_get_contents('sample.xml'); //works Link to comment https://forums.phpfreaks.com/topic/149849-simplexml-and-stripslashes/ Share on other sites More sharing options...
tracivia Posted March 17, 2009 Author Share Posted March 17, 2009 i don't mean that my problem is solved, i have to remove those slashes since i can't modify the data coming from the service. I should say, the reason of the problem instead of "removing stripslashes solves the problem", but i couldn't find the button to edit my message. Link to comment https://forums.phpfreaks.com/topic/149849-simplexml-and-stripslashes/#findComment-786975 Share on other sites More sharing options...
tracivia Posted March 18, 2009 Author Share Posted March 18, 2009 bump Link to comment https://forums.phpfreaks.com/topic/149849-simplexml-and-stripslashes/#findComment-787466 Share on other sites More sharing options...
redarrow Posted March 18, 2009 Share Posted March 18, 2009 str_replace() function mate. Link to comment https://forums.phpfreaks.com/topic/149849-simplexml-and-stripslashes/#findComment-787467 Share on other sites More sharing options...
tracivia Posted March 18, 2009 Author Share Posted March 18, 2009 well the problem is, i have to replace backslashes, so i have to escape that str_replace('\\', '', $str); the above code didn't work and it escapes the second quote. Link to comment https://forums.phpfreaks.com/topic/149849-simplexml-and-stripslashes/#findComment-788072 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.