[PHP] reading from file
I am using the script include below to read the content of a file and output it. When I load this script with the adress of a plain html file it outputs everything like expected, except there are some extra characters spread over the file. They come in little string like '40d' or '1000' and appear on positions where there is 'nothing' in the original source file. Any idea what could cause that behavior? Stefan ? $myServer = 'xxx.xxx.xxx.xx'; $document = 'index.shtml'; $fp=fsockopen($myServer,80,$errno,$errstr,30); $request = GET $document HTTP/1.1\r\nAuthorization: Basic ; $request .= base64_encode(xx:xx) . \r\n; $request .= Host: $myServer\r\n\r\n; if(!$fp) { echo $errstr ($errno)br\n; } else { fputs($fp,$request); while(!feof($fp)) { $line=fgets($fp,4096); echo $line; } fclose($fp); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Classes and arrays
Hi! Can anybody explain to me why this script outputs: oneone instead of: zeroone ??? Thanks, stefan ? class Cart { var $items; // Items in our shopping cart function add_item ($id,$text) { $this-$items[$id] = $text; } function output($id){ echo $this-$items[$id]; } } $c = new Cart; $c-add_item(0,zero); $c-add_item(1,one); $c-output(0); $c-output(1); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Classes adn arrays
Thanks Jack! This was really driving me mad and it was such a little thing Stefan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] include files with PHP 3.0.16
Tim, Check out the include() and require() function of php. Stefan -Original Message- From: Tim Thorburn [mailto:[EMAIL PROTECTED]] Sent: Monday, April 16, 2001 5:38 PM To: [EMAIL PROTECTED] Subject: [PHP] include files with PHP 3.0.16 Hi, I'm currently working on a rather large site and have just completed the navigation portion of it. I'd like to make use of server side includes so that if I have to make changes down the road, I won't have to chance potentially 100s of files. Normally I use !--#include file="filename.inc"-- with .asp and .shtml files, however, this does not seem to work for me using PHP 3.0.16 (the version my web host uses). Is there an equivalent to !--#include file="filename.inc"-- in PHP? And will it work in version 3.0.16. I've gone through the online manual but found nothing that would help in this situation. Thanks -Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]