Jump to content

daq

Members
  • Posts

    43
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

daq's Achievements

Newbie

Newbie (1/5)

0

Reputation

  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.
×
×
  • 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.