The Daily WTF: Curious Perversions in Information Technology
Welcome to TDWTF Forums Sign in | Join | Help
in Search

Lame PHP Screen Scraping

Last post 05-02-2008 7:00 AM by ammoQ. 111 replies.
Page 1 of 3 (112 items) 1 2 3 Next >
Sort Posts: Previous Next
  • 04-30-2008 11:29 AM

    Lame PHP Screen Scraping

    Locked Reply Contact

    http://pastebin.com/f5411ecb9 

     

    Just ran across this awesome code snippet.  Basically, it's a PHP script that runs in cron and screen-scrapes a community website looking for new activity by users.  If it finds any, it posts a message to an IRC channel through a local control socket.  The script has been anonymized to protect the guilty, but the site was for ColdFusion "developers" and it posted to their private IRC room.  The person who wrote it was a ColdFusion "pro" who was new to PHP.  He was obviously unfamiliar with PHP, and with good coding practices in general.  I can't even count the WTFs in this.

    Tired of incompetent moderation?
    Wondering where all the clever discussion went?
    Try irc.slashnet.org #TDWTFMafia.
    We don't ban or kick and everyone is welcome.*

    *Stupid people will be mocked mercilessly and encouraged to commit suicide, however.
  • 04-30-2008 1:43 PM In reply to

    Re: Lame PHP Screen Scraping

    Locked Reply Contact
    I thought you wrote it.
    irc://irc.slashnet.org/TDWTF
    [12:15:49] <Duplication_Prevention_Bot> Human test subjects are illegal! I didn't sign an EULA for this.


    Filed under:
  • 04-30-2008 1:44 PM In reply to

    Re: Lame PHP Screen Scraping

    Locked Reply Contact

     Hey! Wait a minute! I recognize this! 

    This was written by some n00b named morbiuswilters!

    Yes, I have been banned. Thanks to all for a good time.

    Tired of incompetent moderation?
    Wondering where all the clever discussion went?
    Try irc.slashnet.org #TDWTFMafia.
    We don't ban or kick and everyone is welcome.*

    *Stupid people will be mocked mercilessly and encouraged to commit suicide, however.
    Filed under:
  • 04-30-2008 2:55 PM In reply to

    Re: Lame PHP Screen Scraping

    Locked Reply Contact

    My first screen scrape, 6+ years ago, looked a lot like that.  Screen scraping becomes a lot more elegant once you've learned about Xpath, or at least regular expressions.

    The http function is pretty hillarious, but I, too, was guilty of manually crafting requests, the first time I tried screen scraping, albeit in Java.

     

    So if this guy is still in highschool, and has no professional experience, I'll cut him some slack.  If he's actually being paid to write this crap...

     Well, then, WTF.

  • 04-30-2008 3:10 PM In reply to

    Re: Lame PHP Screen Scraping

    Locked Reply Contact

    merreborn:
    My first screen scrape, 6+ years ago, looked a lot like that.  Screen scraping becomes a lot more elegant once you've learned about Xpath, or at least regular expressions.

    This guy knows Xpath and regular expressions.  That's pretty much just what this is doing, I think, except it's using the faster explode method.

     

    merreborn:
    The http function is pretty hillarious, but I, too, was guilty of manually crafting requests, the first time I tried screen scraping, albeit in Java.

    Hmm, it doesn't seem that crazy.  I mean, it does exactly what it needs to and doesn't need a large external library.  It's fast, too.

     

    merreborn:
    So if this guy is still in highschool, and has no professional experience, I'll cut him some slack.  If he's actually being paid to write this crap...

    He's actually the best software developer I've ever worked with, but he wasn't paid for this, he just did it on his own time. 

    Tired of incompetent moderation?
    Wondering where all the clever discussion went?
    Try irc.slashnet.org #TDWTFMafia.
    We don't ban or kick and everyone is welcome.*

    *Stupid people will be mocked mercilessly and encouraged to commit suicide, however.
  • 04-30-2008 3:23 PM In reply to

    Re: Lame PHP Screen Scraping

    Locked Reply Contact
    morbiuswilters:
    He's actually the best software developer I've ever worked with

    Which goes to show how bad the developers you've worked with are. This guy is clearly an idiot. Ugly, too.

  • 04-30-2008 3:25 PM In reply to

    Re: Lame PHP Screen Scraping

    Locked Reply Contact

    bstorer:
    morbiuswilters:
    He's actually the best software developer I've ever worked with

    Which goes to show how bad the developers you've worked with are. This guy is clearly an idiot. Ugly, too.

     

    And obviously full of fail and aids too.

    Yes, I have been banned. Thanks to all for a good time.

    Tired of incompetent moderation?
    Wondering where all the clever discussion went?
    Try irc.slashnet.org #TDWTFMafia.
    We don't ban or kick and everyone is welcome.*

    *Stupid people will be mocked mercilessly and encouraged to commit suicide, however.
    Filed under:
  • 04-30-2008 5:21 PM In reply to

    Re: Lame PHP Screen Scraping

    Locked Reply Contact

    bstorer:
    morbiuswilters:
    He's actually the best software developer I've ever worked with

    Which goes to show how bad the developers you've worked with are. This guy is clearly an idiot. Ugly, too.


     

    George Bernard Shaw said in Pygmalion that "It is impossible for an Englishman to open his mouth without making some other Englishman hate or despise him" ... I have a feeling that the same thing goes for coders on here...


     

  • 04-30-2008 5:35 PM In reply to

    Re: Lame PHP Screen Scraping

    Locked Reply Contact
    PeriSoft:
    I have a feeling that the same thing goes for coders on here...

    Either that, or we're on a level WAAAAAY above your head.

  • 04-30-2008 5:39 PM In reply to

    • henke37
    • Top 500 Contributor
    • Joined on 05-22-2007
    • Sweden
    • Posts 98

    Re: Lame PHP Screen Scraping

    Locked Reply Contact
    Should I be worried that I don't see any direct wtfs here? Well, I can't say it's elegant to write his own http client. Nor can I say that the strpos parsing is clean looking. But it's not that bad. But I still don't know the RAW irc command...
  • 04-30-2008 5:41 PM In reply to

    Re: Lame PHP Screen Scraping

    Locked Reply Contact

     MUG HIM!!!

    Yes, I have been banned. Thanks to all for a good time.

    Tired of incompetent moderation?
    Wondering where all the clever discussion went?
    Try irc.slashnet.org #TDWTFMafia.
    We don't ban or kick and everyone is welcome.*

    *Stupid people will be mocked mercilessly and encouraged to commit suicide, however.
  • 04-30-2008 6:52 PM In reply to

    Re: Lame PHP Screen Scraping

    Locked Reply Contact

    PeriSoft:
    George Bernard Shaw said in Pygmalion that "It is impossible for an Englishman to open his mouth without making some other Englishman hate or despise him" ... I have a feeling that the same thing goes for coders on here...

    Yeah, it's pretty much like that around here.  I posted it because it was a little WTFy, but everyone has to jump in and start talking trash.  I think most of them are just virginal 13 year olds living in their mother's basements who have nothing better to do than troll Slashdot and TDWTF.  Everyone makes mistakes, but these guys act like they are infallible, just because they are jealous that they don't have a job and have never kissed a girl.  Calling someone ugly?  That's a real mature attitude, guys.  Thanks for raising the level of discourse around here.  I'd love to see some of the code produced by these self-proclaimed "experts".. 

    Tired of incompetent moderation?
    Wondering where all the clever discussion went?
    Try irc.slashnet.org #TDWTFMafia.
    We don't ban or kick and everyone is welcome.*

    *Stupid people will be mocked mercilessly and encouraged to commit suicide, however.
  • 04-30-2008 7:22 PM In reply to

    Re: Lame PHP Screen Scraping

    Locked Reply Contact

    ... and before the obligatory "calm down, your idiot, we're only joking here" comment of MPS, bstorer, Lingerance or friends comes in, maybe there are actually some people, who, despite all evidence want to use this forum for discussion and - believe it or not - find you so-called "jokes" actually not funny...

    Please think about it for a second.

  • 04-30-2008 7:53 PM In reply to

    Re: Lame PHP Screen Scraping

    Locked Reply Contact

    PSWorx:
    Please think about it for a second.
     

    Foolish human, your pleas for common decency are doomed to fail! 

    Filed under:
  • 04-30-2008 8:47 PM In reply to

    Re: Lame PHP Screen Scraping

    Locked Reply Contact

    morbiuswilters:
    Yeah, it's pretty much like that around here.  I posted it because it was a little WTFy, but everyone has to jump in and start talking trash.  I think most of them are just virginal 13 year olds living in their mother's basements who have nothing better to do than troll Slashdot and TDWTF.  Everyone makes mistakes, but these guys act like they are infallible, just because they are jealous that they don't have a job and have never kissed a girl.  Calling someone ugly?  That's a real mature attitude, guys.  Thanks for raising the level of discourse around here.  I'd love to see some of the code produced by these self-proclaimed "experts".. 
    You make a good point, but making it isn't going to help.  Do you really expect they'll respond positively to this?

    Legendary Thread
    Yes my avatar is a fictional character, get over it. (Before she chokes you with her mind.)
  • 04-30-2008 9:07 PM In reply to

    Re: Lame PHP Screen Scraping

    Locked Reply Contact
    Eternal Density:
    Do you really expect they'll respond positively to this?
    They're more likely to point out the fact that you quoted his entire post. FYI: You don't need to quote his entire post, just the one sentence you were responding too.
    irc://irc.slashnet.org/TDWTF
    [12:15:49] <Duplication_Prevention_Bot> Human test subjects are illegal! I didn't sign an EULA for this.


  • 04-30-2008 9:13 PM In reply to

    Re: Lame PHP Screen Scraping

    Locked Reply Contact

    Lingerance:
    just the one sentence you were responding too.
    I was responding to the whole thing, so I should have used <snip>.  My apologies.

    [edit]Hang on, since you're the one who pointed out that I quoted the entire post, does that make you one of them?  (j/k) 

    Legendary Thread
    Yes my avatar is a fictional character, get over it. (Before she chokes you with her mind.)
  • 04-30-2008 9:16 PM In reply to

    Re: Lame PHP Screen Scraping

    Locked Reply Contact
    Eternal Density:
    does that make you one of them
    No, they don't assimilate furies.
    irc://irc.slashnet.org/TDWTF
    [12:15:49] <Duplication_Prevention_Bot> Human test subjects are illegal! I didn't sign an EULA for this.


  • 04-30-2008 9:19 PM In reply to

    Re: Lame PHP Screen Scraping

    Locked Reply Contact

    PSWorx:

    ... and before the obligatory "calm down, your idiot, we're only joking here" comment of MPS, bstorer, Lingerance or friends comes in, maybe there are actually some people, who, despite all evidence want to use this forum for discussion and - believe it or not - find you so-called "jokes" actually not funny...

    Please think about it for a second.

    Yeah, I don't know what is up with their attitude.  The second you try to have an intelligent debate the goon squad shows up and turns it into a flamefest.  I think I've seen a few hundred threads absolutely ruined by MPS.  I don't know where they get off trying to disrupt the polite discussions on this forum, but it needs to stop.  Lingerance may be the worst of the bunch, though.  He keeps a low profile but he works himself into a furry over the smallest things.  And bstorer..  what can you say about a guy like that?  The three of them were trolling this poor guy who did ColdFusion work about a week ago.  The guy just wanted to ask questions and they kept telling him "ColdFusion is for retards".  Now, I may not care much for the language, but I'm not going to pass judgement on others.  Let's try to be mature here, people.
    Tired of incompetent moderation?
    Wondering where all the clever discussion went?
    Try irc.slashnet.org #TDWTFMafia.
    We don't ban or kick and everyone is welcome.*

    *Stupid people will be mocked mercilessly and encouraged to commit suicide, however.
  • 04-30-2008 9:28 PM In reply to

    Re: Lame PHP Screen Scraping

    Locked Reply Contact
    morbiuswilters:
    Lingerance may be the worst of the bunch, though.  He keeps a low profile but he works himself into a furry over the smallest things.
    Yeah but small things are like paper cuts; eventually I'll get enough to bleed to death.
    irc://irc.slashnet.org/TDWTF
    [12:15:49] <Duplication_Prevention_Bot> Human test subjects are illegal! I didn't sign an EULA for this.


  • 04-30-2008 9:39 PM In reply to

    Re: Lame PHP Screen Scraping

    Locked Reply Contact
    morbiuswilters:
    And bstorer..  what can you say about a guy like that?

    What can you say about a guy like that? How about that he is more than willing to have a rational, interesting discussion on these boards, but nobody ever wants one. Instead, it devolves into a debate on minuta of obscure OS/language features or complaints about MPS, who is only working to make these boards better. Why can't you people deal with the fact that we have just as much right to post here as you do. If you don't like it, maybe you should go program PHP with the idiot who wrote the OP code.

  • 04-30-2008 9:51 PM In reply to

    Re: Lame PHP Screen Scraping

    Locked Reply Contact

    bstorer:
    What can you say about a guy like that? How about that he is more than willing to have a rational, interesting discussion on these boards, but nobody ever wants one.

    I seem to remember you working to pollute the tag cloud with garbage in an attempt to destroy the user experience for everyone else here.  Just because your mom asked you to clean your room you can't let anybody else enjoy themselves, huh?

     

    bstorer:
    Instead, it devolves into a debate on minuta of obscure OS/language features or complaints about MPS, who is only working to make these boards better.

    Yeah, flaming new users who accidentally click the quote button when replying to the OP sure is productive.  MPS is just playing mind games with this entire forum.  He's got all of you ensnared in his little web and you're nothing but pawns in his quest for domination.

     

    bstorer:
    Why can't you people deal with the fact that we have just as much right to post here as you do.

    Just because you have the right doesn't mean you should.  I have the right to punch my wife in the face, but it's not something I'm going to do unless I really have to.  With great power comes great responsibility and you must wield immense power with care, whether it is posting in a forum or being master to your bride.

     

    bstorer:
    If you don't like it, maybe you should go program PHP with the idiot who wrote the OP code.

    More personal attacks, hmm?  Just keep it up, sir, and see how kindly the intelligent folks around here react.  We're not all fools, you know. 

    Tired of incompetent moderation?
    Wondering where all the clever discussion went?
    Try irc.slashnet.org #TDWTFMafia.
    We don't ban or kick and everyone is welcome.*

    *Stupid people will be mocked mercilessly and encouraged to commit suicide, however.
  • 04-30-2008 10:04 PM In reply to

    Re: Lame PHP Screen Scraping

    Locked Reply Contact
    morbiuswilters:

    bstorer:
    Instead, it devolves into a debate on minuta of obscure OS/language features or complaints about MPS, who is only working to make these boards better.

    Yeah, flaming new users who accidentally click the quote button whe