Jump to content

daq

Members
  • Posts

    43
  • Joined

  • Last visited

    Never

Everything posted by daq

  1. I put the increment in the wrong place, it was supposed to be $c = (isset(content[++$c])) ? $c : 0
  2. The disadvantage of this way is that I will have to check before each use. With something like a try catch, I would only have to write code that handles out of bounds once. But this is a great suggestions if nothing like try catch is available. Even shorter: $c = (isset($arr[$c])) ? $C++ : 0;
  3. Array is not used in a loop, but in various places throughout the code. The code goes through approximately 4-7 $c increments during the run. To clarify, loop does not iterate the array, but rather pulls incremental values from it when it needs them. I just need a way to reset the index when it goes out of bounds.
  4. Couple of questions about arrays: 1. Does array value with index out of bounds always return NULL or is there a chance it will return garbage? I.e.: $myArr ("one", "two"); echo "Value of " . $myArr[5]; 2. I'm iterating through an array throughout a large chunk of code with a basic array[$c++]. What's the best way to monitor index without reinventing the wheel? I was hoping to be able to catch an out of bounds exception to reset the index ($c) to 0, but it doesn't throw one. Thanks.
  5. daq

    Cache fopen

    I'm sorry for posting a million things, but this simple test script, seems to work without problems: <?php $rss_url = "http://feedproxy.google.com/Explosm"; $f = curl_init(); curl_setopt($f, CURLOPT_URL,$rss_url); curl_setopt($f, CURLOPT_CONNECTTIMEOUT, 2); curl_setopt($f, CURLOPT_RETURNTRANSFER, true); curl_setopt($f, CURLOPT_VERBOSE, true); if ($rss_content = curl_exec($f)) { echo $rss_content; } curl_close($f); ?> This is the same code I use in my RSS reader which is showing old data.
  6. daq

    Cache fopen

    Wow. I was wrong. Even after I updated the links, I'm still getting old data even with curl. Where the hell can it be coming from?
  7. daq

    Cache fopen

    OK, I figured it out with the help of Curl. Both RSS feeds that were showing old data changed address and were returning a 301, page moved permanently. I'm surprised the script worked at all. And I still don't know where the old data came from. At least the problem is gone. Thanks to everyone for the help!
  8. daq

    Cache fopen

    Its a closed site, but the problem is not reproducible 100% of the time and my host, 1&1, completely blocks all error messages so you wouldn't see much more than outdated rss feeds.
  9. daq

    Cache fopen

    Interesting. Using curl, the feeds that showed old content, don't show any data at all. I wonder if a timeout or something similar causes web host to use cache?
  10. daq

    Cache fopen

    No, it shows updated information.
  11. daq

    Cache fopen

    This is a great solution that should've worked, but I'm still getting outdated data.
  12. daq

    Cache fopen

    Sorry, I guess I wasn't specific enough. I didn't mean browser cache. I meant server side cache for fopen.
  13. I created an online rss reader using lastRSS http://lastrss.oslab.net/. Basically, all it does is read the xml from rss feed using fopen and then parses it. It works great but occasionally, it gets stuck on rss items from several months ago and refuses to update. I don't use caching of any kind so I have no idea where old data comes from. Since I'm out of ideas I'm coming up with insane theories to justify this behavior. Is it possible my web host is caching fopen requests? Is that even possible? Any help appreciated.
  14. <?php $ip = $argv[1]; echo $ip; echo "\n"; echo checkdnsrr($ip) ? 'True' : 'False'; #echo echo checkdnsrr($ip, 'ANY') ? 'True' : 'False'; echo "\n"; echo gethostbyaddr($ip); echo "\n" ?> "php ip.php 64.233.167.99" returns: 64.233.167.99 False py-in-f99.google.com Command that searches for ANY dns record returns false as well.
  15. Its actually a console app. I feed the ip manually (or it is read from a file,) but I know for sure ip is correctly formatted.
  16. It works correctly for me. When timeout is less than time it takes to transfer, it quits. Could it be that something else in your function hangs the program?
  17. Will using curl arguments work? --connect-timeout <seconds> Maximum time allowed for connection -m/--max-time <seconds> Maximum time allowed for the transfer
  18. I searched the forum and found nothing. echo checkdnsrr($ip) ? 'True' : 'False'; returns false no matter what $ip is. The function does work correctly when I feed it the name, but ip address consistently fails. Anyone dealt with this before? Any suggestions other than using exec(host) || exec(nslookup) welcome. :-) Thank you.
  19. Is there anything in the code that could output that? Are you sending any unusual http headers to browsers? Since it goes away after a refresh I'm assuming it is some variable that is either set or not set and not a configuration issue since those are permanent. Check your variables. If you want to try and hide this under the carpet, create an .htaccess file in the folder where the script is which contains the following: php_flag log_errors off If its your server there is also a way to control this from php.ini If that doesn't make it go away, it might be something with Apache and not PHP. Check Apache log files.
  20. Thanks, that's exactly what I was looking for!
  21. Are you by any chance running phpinfo() anywhere in your script? Maybe on error? Also, disable error output to anywhere but the log files.
  22. OK, I guess I made the question unclear. While Alias was helpful, I was using symlink to serve the same purpose, my problem was with permissions. The problem still remains. To be honest I was looking for something more like suExec -- I couldn't find a good tutorial on it anywhere. Thanks for your help though.
  23. I feel stupid, thanks a lot! Could you explain how it goes around permissions? or point me to a link where it's explained?
  24. You can change to 8080 I think most browsers try it by default if 80 fails.
  25. The line 115 that loads php needs to look like this if file is really in C:\php\ (You have extra slash and a space) LoadModule php5_module c:/php/php5apache2.dll Try setting line 150 to something else, just to make sure its not permissions problems. Make a folder called www on C:\ drive, then set like 150 to DocumentRoot "C:/www" In that folder, make a file called index.html that displays something like "hello world" so apache gets an index file. Also set line 178 to the same path <Directory "C:/www"> Change line 163 to (you override it later, but just in case) Order allow,deny Permissions could be a problem in vista, I never had any problems in XP, but you can test a new folder just in case. 163 is probably what's causing the problems PHP should load fine once you change line 115.
×
×
  • 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.