Jump to content

topcoder1

Members
  • Posts

    26
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

topcoder1's Achievements

Member

Member (2/5)

0

Reputation

  1. I'm trying to use fopen another url, it doesn't work on localhost, however it works on other domains(such as google.com). The localhost url is valid. I have tried both fopen and file_get_contents. the php page simply hangs and says: PHP Warning: fopen(http://localhost/) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.\r\n in D:\\Program Files\\Apache Group\\Apache2\\htdocs\\myapp\\callurl.php on line 3 [Thu Apr 30 14:43:22 2009] [error] [client 127.0.0.1] PHP Fatal error: Maximum execution time of 30 seconds exceeded callurl.php: <?php //$content = file_get_contents("http://localhost/myapp/test.php"); $handle = fopen("http://localhost/", "r"); $contents = ''; while (!feof($handle)) { $contents .= fread($handle, 8192); } fclose($handle); echo($contents); ?>
  2. given a path, I want to check to see if a directory exists, then create one if it doesn't. dir(path) gives an error: [function.dir]: failed to open dir: Invalid argument . Are there functions allow me to do all those? thanks
  3. thanks, but even this doesn't work. Parse error: syntax error, unexpected T_OBJECT_OPERATOR I have to say: <?php class Test { public function oops() { echo 'oops."; } } $t=new Test(); $t->oops(); ?> I am using php4 though. Is there a way to not to create a temporary reference before calling the class member function? I mean is there a way to say invoke oops function on new Test() directly?
  4. <?php class Test{ function oops(){ echo("oops"); } } new Test().oops(); ?> error: Call to undefined function: oops() any idea? thanks
  5. I know there are two ways to pass arguments to an included page. 1. declare variable in the main page, and the included page will have access to this variable by default scope. in main.php $test="hi"; <?php include("include1.php");?> 2. pass the argument from get in main.php <?php include("include1.php?test=hi");?> the second way doesn't pollute the namespace but is limited to pass simple arguments(not arbitrary objects). Is there any other way?
  6. I have the following setup: Main.php includes A.php and B.php in A.php I make an ajax call to C.php which modifies data X. Now I reload B.php, can I get data X in B.php? I don't want to pass information to B from client side to reconstruct X. thanks!
  7. solution according to hbertini at sapo dot pt 13-Mar-2005 03:29 workaround when using session variables in a .php file referred by a frame (.html, or other file type) at a different server than the one serving the .php: Under these conditions IE6 or later silently refuses the session cookie that is attempted to create (either implicitly or explicitly by invoquing session_start()). As a consequence, your session variable will return an empty value. According to MS kb, the workaround is to add a header that says your remote .php page will not abuse from the fact that permission has been granted. Place this header on the .php file that will create/update the session variables you want: <?php header('P3P: CP="CAO PSA OUR"'); ?> Regards, Hugo http://us.php.net/function.session-start
  8. yes I am. Here's the complete code: index.php session_start(); $_SESSION['mydata']=$_POST['mydata']; // ok session_write_close(); //ensures that I dont lock the session for too long another php page I invoke later session_start(); error_log(print_r($_SESSION,1)); //nothing in the session array! also the html file that has the iframe is hosted by a different domain than the phps. They are both hosted on the same machine however. The problem only occurs on IE.
  9. I have a php app running inside an iframe. I pass a piece of info to this iframe through http parameters, php gets it and then set it in the session. However, the session data is lost when I read it from another php page within the same php application. index.php which resides in an iframe session_start(); $_SESSION['mydata']=$_POST['mydata']; // ok another.page that I later invoke error_log(print_r($_SESSION,1)); //nothing! this weirdness only happens on IE. and if I refresh the iframe again, the session data will be available. any idea? thanks
  10. no, that's the only configuration for gzip.
  11. I want to config gzip on apache server so that it compress everything except streaming files and images. I did AddOutputFilterByType DEFLATE text/plain text/javascript text/html. But it seems that certain request for file/image data gets gzipped as well. for example client sends a request http://myhost/file_streamer.php?id=101, my file_streamer.php respond with: function stream_file($filename, $file, $file_len=null){ header("Content-Disposition: attachment; filename=\"".$filename."\""); header("Content-Type: application/octet-stream");//octet-stream application/octet-stream if($file_len!=null)header("Content-Length: ".$file_len); header("Pragma: no-cache"); header("Expires: 0"); print $file; exit(); } I dont want this response content to be gzipped, how do I filter it properly? thanks
  12. thanks but if I create a config.php that sets my app file root, then I need to include that config.php as well... this problem becomes circular.. might as well put everything under the app root... there has to be a simple solution right? I searched for a while and not able to find one...
  13. I have 3 files Index.php, x.php and login/Login.php in Login.php <?php require_once "../x.php"; ?> Index.php <?php require_once "login\Login.php"; ?> when executing Index.php error is Failed opening required '../x.php' I can of course say <?php require_once "x.php" ?> in Login.php, then Index.php would load fine.. However if I load login\Login.php independently, x.php would not be found. So what should I do?
  14. Thanks! for 2) I found out that there's a bug in my mysql community server version 5.02 http://bugs.mysql.com/bug.php?id=14955 so I'm stuck with 1MB max file insert blob unless I upgrade mysql server.... which I am hesitant to do. so much for trying to store files in database...
  15. question 1: there's a limit on how much you can upload and insert into a blob field in phpMyAdmin: 8192 kb, this is certainly not the blob limit, a quick search on google says it's a process stack size limit. what is this 8192 kb limit? is it simply the limit on file size that can be uploaded into phpMyAdmin? what's the reason behind it? question 2: another related issue is whenever I tries to insert a big file(for example, >1MB) into a longblob field using mysql_query, mysql dies and says "MySQL server has gone away"), smaller files are ok.. what's up with that? thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.