dmulyava Posted July 6, 2007 Share Posted July 6, 2007 Hi folks ... I suspect that this will be a trivial question to the experts here, and you will be able to help me out. I have been using a shared hosting account while developing my script, and now I have to move it to the production server. One thing I realized, though, is that the test server was using PHP 4.4.6, and the new (production) server is using 4.3.9; There is something different between these two versions, or between the php_ini variables, that is throwing off how my scripts are using multiline strings. Here is an example. Consider the following code. It opens an external website, reads it's contents into a variable. It then scans the variable for a string, and outputs it's location. On the test server - this page outputs 215. On the new server, nothing is echoed.. meaning that it did not find the string. What should I be looking into? Thanks a big bunch! :thumbsup: <?php $c=""; $openurl="http://cnn.com"; $file = fopen($openurl,"r"); while(!feof($file)) $c .= fgets($file, 1024); fclose($file); $findme1 = '<meta http-equiv="refresh" content="1800"> <meta name="Description" content="CNN.com delivers the latest breaking news and information on the latest top stories, weather, business, entertainment'; $pos1 = strpos($c, $findme1); echo $pos1; ?> Have done some further poking around.. consider the code <?php $c=""; $openurl="http://cnn.com"; $file = fopen($openurl,"r"); while(!feof($file)) $c .= fgets($file, 1024); fclose($file); $findme1 = '<meta http-equiv="refresh" content="1800"><br> <meta name="Description" content="CNN.com delivers the latest breaking news and information on the latest top stories, weather, business, entertainment, politics, and more. For in-depth coverage, CNN'; echo strrev($findme1); ?> This code outputs the reverse of the string. The result? The "working" server returns: NNC ,egarevoc htped-ni roF .erom dna ,scitilop ,tnemniatretne ,ssenisub ,rehtaew ,seirots pot tsetal eht no noitamrofni dna swen gnikaerb tsetal eht sreviled moc.NNC"=tnetnoc "noitpircseD"=eman atem< >rb<>"0081"=tnetnoc "hserfer"=viuqe-ptth atem< The nonworking server returns NNC ,egarevoc htped-ni roF .erom dna ,scitilop ,tnemniatretne ,ssenisub ,rehtaew ,seirots pot tsetal eht no noitamrofni dna swen gnikaerb tsetal eht sreviled moc.NNC"=tnetnoc "noitpircseD"=eman atem< >rb<>"0081"=tnetnoc "hserfer"=viuqe-ptth atem< A blank line between the two lines! Quote Link to comment Share on other sites More sharing options...
teng84 Posted July 6, 2007 Share Posted July 6, 2007 ??????? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.