EG Information

Main Index
EG Manual
Disclaimer
Legal Information
Hall of Fame
Hall of Shame
Member Rankings
Members List
Meet the Staff

Training Missions

Read Me First
Basic Skills
Realistic Scenarios
Cryptography
Software Cracking
Linux ELF Binary Cracking
Logical Thinking
Programming
Captcha Cracking
Patching
Steganography
Deface This Wall
/dev/null
/dev/urandom
/dev/extra

Knowledge Bank

Discussion Forums
Exploit Database New
PasteBin New
RSS Feeds RSS
Articles / Tutorials
Videos
Online EG MP3 Player Radio
Downloads
Tools

Code Resources

Submit Code
Ajax
ASM
Bash
C
CPP
Csharp
Delphi
Haskell
Java
Javascript
Jython
Lisp
mIRC
MySQL
Perl
PHP
Python
QBASIC
VisualBasic

Pimp Us Out!

Review enigmagroup.org on alexa.com

Has Enigma Group Helped You? Then Help Us By Advertising For Us. Place One Of The Following Images On Your Site And Create A Link Back To Enigma Group.

Enigma Group

Enigma Group

Enigma Group

Enigma Group

 

Affiliates



The Urinal

hackhound.org

suck-o.com

hack.org.za

flyninja.net

 

Enigma Group's Code Bank


RSS cache script

By: Ausome1  -  Date Submitted: 2008-09-25 18:59:59

  1. <?php
  2. /**
  3.  * RSS cache script
  4.  *
  5.  * Run this script via cron. I run mine every 15 minutes. This will cache rss feeds on your local
  6.  * machine in /tmp naming the files rss1.cache, rss2.cache and so on. Have your rss reader access
  7.  * your rss feeds that are locally stored. This will keep you from getting banned to that rss feed
  8.  * if you're hitting it on every page load and save you and the rss supplier lots of bandwidth.
  9.  *
  10.  * This script also uses parallel processing. It will go out and grab the rss feeds all at once.
  11.  * Lets say you want to gather data from 5 sites and each site takes 5 seconds to scrape. Gathering
  12.  * each site sequentially would take 25 seconds (5 x 5) for the script to complete. Running the
  13.  * gathering in parallel allows the script to finish in 5 seconds. The length of the longest scrape.
  14.  *
  15.  * @author Ausome1
  16.  */
  17.  
  18. // URLs of content you wish to cache.
  19. $urls = array('http://example1.com/rss.xml',
  20. 'http://example2.com/rss.xml',
  21. 'http://example3.com/rss.xml',
  22. 'http://example4.com/rss.xml',
  23. 'http://example5.com/rss.xml'
  24. );
  25.  
  26. // No need to alter anything past here.
  27. $count = count($urls);
  28.  
  29. // Create cURL instances, set URL, and other appropriate options.
  30. for ($i = 1; $i <= $count; ++$i)
  31. {
  32. $handle = 'ch' . $i;
  33. $$handle = curl_init();
  34. curl_setopt($$handle, CURLOPT_URL, $urls[$i - 1]);
  35. curl_setopt($$handle, CURLOPT_HEADER, 0);
  36. curl_setopt($$handle, CURLOPT_RETURNTRANSFER, 1);
  37. }
  38.  
  39. // Create the multiple cURL handle.
  40.  
  41. // Add handles
  42. for ($i = 1; $i <= $count; ++$i)
  43. {
  44. $handle = 'ch' . $i;
  45. curl_multi_add_handle($mh, $$handle);
  46. }
  47.  
  48. $running = NULL;
  49.  
  50. {
  51. curl_multi_exec($mh, $running);
  52. } while ($running > 0);
  53.  
  54. // Retrieve content and write data to cache file.
  55. for ($i = 1; $i <= $count; ++$i)
  56. {
  57. $handle = 'ch' . $i;
  58. $data = 'data' . $i;
  59. $response_code = 'response_code' . $i;
  60. $$data = curl_multi_getcontent($$handle);
  61. $$response_code = curl_getinfo($$handle, CURLINFO_HTTP_CODE);
  62. if ($$data && $$response_code != '404')
  63. {
  64. file_put_contents('/tmp/rss' . $i . '.cache', $$data);
  65. }
  66. curl_multi_remove_handle($mh, $$handle);
  67. }
  68.  
  69. // Close curl session.
  70. ?>
Return to php category list

Who Visited EnigmaGroup Today?

1579 Guests, 270 Users (182 Spiders)
GothicLogic, InjectioN, Hessesian, whisperer, limited, whoami, hackaday, Rex_Mundi, trueorfalse, strudels, Bumpadjuppy, DrOptix, Klosse, blackknight911, Effomeidonize, Distorted, JohnMalkovitzch, TheHarrisonW, Obop, hkevin, ellisp, Vreality2007, advenlydent, zach, ddxc, suetekh, Vengeance987, m0rt, 2345, electro-technic, riesenjoe, IvanDimitriev, nmobin27, RomeoG, timetrust, 2142, 3ntr0py, BillTuer, advilapyday, lotato, lonely.connection, CloverCipher, vnd, aurena, rospark, valy1177, Blavatsky, learning, st3alth, Partisan, K0gller, fitz, Jayjay, psychomarine, Vspectrum, San Marino, TinCardinal, brunoriversyhn, code-g, yshiau, Psiber_Syn, Seasharp, obencefoozy, SlayingDragons, Link-, tinuigimeni, jasonbourne, Fred, somebody777, Meonkzt, CJ_Omaha, jearrorne, cls777, unsugsNashy, Balksnuntails, Sir D. Naut, batsbargy, Rik, Macabre, Nightraven, Iccyx, Repuhlsive, vipervince2002, Janomatrix, lol, veceattainc, techno, Exclaw, Nikhil, evjfvir967nj, Mod777, dark_void, nermtode, Tjm, bjy1997, hecky, saraf, elprof, damoniceht, trik, jordan86, SnoopSky, dan_movie, OnetInsolefon, darkfire1515, seojlhmyrhwh, Thoplehap, MaxMeier, 1028rajeev, Abhinav2107, autotuneuser, alexelixir, Tauya, Jozinbrejl, kernel_mod, quolc, anandoump, vladavlada, Taicadine, AnnaNoult, GreenTiger, baripadatimes, Ewing, Blackbeard, thepuppeteer, BON-SELE, hak4r, Unotohumsmush, NIGHTWOLF, m4f10, avacraft, becool, thecoder, n01se, alpha1, saki, ObesseJew, ActictGlync, sajan, unicornrainbow, Domihoolbob, matt.14, max66, SnowFury, Spud101, myfabregas, Ausome1, kajman121, Frudopvia, ideveloper6, OLOLO, Bugshuppy, lamb, VagWirura, LialiTiTviors, Ordeptpen, scifics, Pozycj-Z21, Gkjt, interPuscruse, aaftab, TheCheeseDemon, blackcyxx21, jollyjimbo, N4g4c3N, rineDriekly, Rap70r, Xargos, flarornEral, ovetz13, sonu sahu, Breezy, emitleBen, Hackpad, JWTSR, nicyun, kaizo, itevainee, luke460, AverageJoe, zeratu92, litbk, Mr.Pickle, mannavard1611, LoopyLion, NexusVos, mtroscheck, burberrybagsjr, nikedunksxm, xordux, jeho, Lonewolf034, Dragonite, nhorton, Reloaded, Odile, Kaptain_k1rk, Teefelltugh, grizzly, posthuman01, jakesboy2, pwnpwnlolz, Sabo, Lakhoamnmek, Røgue, dot_Cipher, mori, snickerless1, cart1m, Xendz, KELATALFTUS, hubris, Afrika, welepocourl, carpinteyrofbt, ReottphoffBom, Reahastegah, pumashoesld, pdanielt, dmac006, DnA-Ender, Red Fox, couptupleakb, ryanjcrook, iMaxx, sh3llcod3, TimHortons, EmilaHapsaums, Feld Grau, burgeoningneophyte, Maroonhat, CookieAu, tinkansinar, Mitodina, timberlandoutletlufc, zsefvy, guccioutletox, AlexDiru, AbercrombieFitchhl, Ryuske, r0z4, slchill, kalak55, Ph4Kt480ii, beefarn, Jigoku, WrossyJes, pollolololo, ZepSung, Fragility, jell0, C9019, Othrguy, Noticon, KIKNWING, llasarus, mdubz, leah027, iellswo, MAZI_, Estilaamoli, subtentar, Trollorful, no, nas0151, Traybo, howisthechicken, thethird3y3, Somethingclever, marplusz
 
Enigma Group