Lame PHP Screen Scraping



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



  • I thought you wrote it.



  •  Hey! Wait a minute! I recognize this! 

    This was written by some n00b named morbiuswilters!



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



  • @merreborn said:

    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 said:

    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 said:

    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. 



  • @morbiuswilters said:

    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.



  • @bstorer said:

    @morbiuswilters said:
    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.



  • @bstorer said:

    @morbiuswilters said:
    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 "<font face="sans-serif, Helvetica, Geneva, Arial, SunSans-Regular">It is impossible for an Englishman to open his mouth without making some other Englishman hate or despise him" ... </font>I have a feeling that the same thing goes for coders on here...


     



  • @PeriSoft said:

    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.



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



  •  MUG HIM!!!



  • @PeriSoft said:

    George Bernard Shaw said in Pygmalion that "<font face="sans-serif, Helvetica, Geneva, Arial, SunSans-Regular">It is impossible for an Englishman to open his mouth without making some other Englishman hate or despise him" ... </font>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".. 



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



  • @PSWorx said:

    Please think about it for a second.
     

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



  • @morbiuswilters said:

    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?



  • @Eternal Density said:

    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.



  • @Lingerance said:

    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) 



  • @Eternal Density said:

    does that make you one of them

    No, they don't assimilate furies.



  • @PSWorx said:

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



  • @morbiuswilters said:

    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.



  • @morbiuswilters said:

    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.



  • @bstorer said:

    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 said:

    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 said:

    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 said:

    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. 



  • @morbiuswilters said:

    @bstorer said:

    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.

    Yes, but even pawns can be promoted to queens eventually.

     

    Drama queens, that is! If it's any consolation, just get the people you want to shut up to shut up.



  • @morbiuswilters said:

    Lingerance may be the worst of the bunch, though.  He keeps a low profile but he works himself into a furry

    @Lingerance said:

    Filed under: GD it I'm not a furry, I just happen to have a large collection of Hentai containing anthropomorphic animals.
     

    i lol'd 



  • @Otterdam said:

    Yes, but even pawns can be promoted to queens eventually.

     

    Drama queens, that is! If it's any consolation, just get the people you want to shut up to shut up.

    Thank you for your kind support.  It's heartening to know that there are still people on this forum who will stand up against this kind of bullying.  I have decided to part ways with TDWTF for the time being.  Maybe after a little bit things will calm down, but his environment is not conducive to productive discussion.  This place has given a lot to me and I hope I was able to contribute something useful in my time here.  I leave knowing that I did my best and that I didn't sink to the level of Lingerance and his petty gang.  Take care, dear friend, I hope that you can weather the drama of this place better than I did. 



  • @morbiuswilters said:

    I hope I was able to contribute something useful in my time here.

    Nope. Just empty rhetoric and whiny assaults on people with larger post counts who've been here longer.



  • @morbiuswilters said:

    I think I've seen a few hundred threads absolutely ruined by MPS.
     

    No, U!



  • @MasterPlanSoftware said:

    No, U!

    post did not contain expected levels of humour. would not reply again F--- 



  • powering up ma lazars!



  • @bstorer said:

    @morbiuswilters said:
    I hope I was able to contribute something useful in my time here.

    Nope. Just empty rhetoric and whiny assaults on people with larger post counts who've been here longer.

    Since I started this thread, I can't seem to stop receiving emails about it so I'm still getting this harrassment in my inbox.  This is a work account and the kind of language you guys use could get me fired.  I know you think you're amazing because you managed to produce several hundred pages of garbage posts, but please stop harrassing me at my place of work.  You already got my friend Russell on probation with your "pranks" including sending a Marine recruiting officer to his place of work.  I know that to you guys this is funny, but some of us have families to think of and I cannot afford to lose my job with the economy as it is.  Please let this thread die and let me leave the forum unmolested.



  • @morbiuswilters said:

    including sending a Marine recruiting officer
     

    No way! You too? 

     

    Man... Marines don't find that shit funny.... I feel sorry for your friend.



  • @morbiuswilters said:

    This is a work account and the kind of language you guys use could get me fired.

    Oh, shit! My fucking bad, dude.


    @morbiuswilters said:
    I know you think you're amazing because you managed to produce several hundred pages of garbage posts, but please stop harrassing me at my place of work.

    I don't care at all about my thread count. You seem to, though, the way you revive dead threads over and over just to quote the whole OP and provide no useful information. We have simple rules on this forum to make it a better place for everyone, and you can't seem to follow them.


    @morbiuswilters said:
    Please let this thread die and let me leave the forum unmolested.

    Again, why do you care so much? Why do you keep posting to whine about how this thread won't die? Do you not understand the irony there?



  • @bstorer said:

    You seem to, though, the way you revive dead threads over and over just to quote the whole OP and provide no useful information.
     

    Yeah really, we have enough of that crap around here. STOP QUOTING THE WHOLE OP N00B!!!



  • @MasterPlanSoftware said:

    @bstorer said:

    You seem to, though, the way you revive dead threads over and over just to quote the whole OP and provide no useful information.
     

    Yeah really, we have enough of that crap around here.

    [citation needed]



  • @Otterdam said:

    [citation needed]
     

    ERROR: STACK OVERFLOW



  • @morbiuswilters said:

    Since I started this thread, I can't seem to stop receiving emails about it so I'm still getting this harrassment in my inbox.  This is a work account and the kind of language you guys use could get me fired.
     

    Looks like you've learned a valuable lesson not to mix business with pleasure.

     

    Oh, okay, I guess you didn't learn it. You'd have to have had pleasure first. 



  • @Otterdam said:

    [citation needed]

    [new joke needed]



  • @bstorer said:

    [new joke needed]
     

    Don't be so cruel to [citation needed]. He's only trying to make a new living for himself elsewhere on the internet, give people a few laughs, you know? Can you imagine how it feels to be Jimmy Wales's bitch slave across his whole project? Hated by Wikipedia editors? Not to mention the indignity of appearing alongside sentences like "It has been reported that bstorer has a 12-inch manhood[citation needed]."

    You're a heartless man. Truly heartless. I wonder how you can sleep at night.



  • @Otterdam said:

    I wonder how you can sleep at night.
     

    It is bstorer, we all know how...

    On top of a pile of worn out furries...



  • @MasterPlanSoftware said:

    On top of a pile of worn out furries...
     

    Some people have soft toy animals on their bed. bstorer has the embalmed corpses of wannabe wolves and foxes.



  • @Otterdam said:

    Oh, okay, I guess you didn't learn it. You'd have to have had pleasure first. 

    I guess I misread you, Otterdam.  I figured you were one of the people fed up with the childish turn this forum has taken in the last 3.5 months.  Now I see that you're no better than my enemies here.  That's fine, we all make our choices in life, but remember that the Almighty is the final judge of a person's character.  Do you want to explain to Jesus how you spent your life hurling insults at his children.  This is a man who death could not stop for more than 72 hours.  Please reconsider the decision you have made.  The power to stop the forward march of evil lies in the heart of every man, woman and child.  I know I may not have convinced you of anything tonight, but hopefully I've made you think.  I will say a few more prayers than usual for you tonight, Otterdam.  You need all the help you can get and I hope you remember the kindness of this stranger someday and are moved by my kindness. 



  • @morbiuswilters said:

    You need all the help you can get and I hope you remember the kindness of this stranger someday and are moved by my kindness. 

    Oh, please. Spare us.



  • @morbiuswilters said:

    I guess I misread you, Otterdam. 
     

    Yes, yes, you did. Now you leave me very confused. Here I am posting to move things into absurdity and away from the subject of you, and earlier making a joke about not having pleasure in your time here, and you take a look at it and think it's some insult directed at you. That's fine, we all make our choices in life, but remember that people here will judge you on your character and the Almighty is still a long wait away. Now I see that you're no better than your so-called enemies here. And I absolutely hate that kind of religious spiel.

    I would ask you to reconsider, but after your condescending attitude telling me 'I need all the help I can get' and saying more prayers than usual, I hardly think it worth it. At least insults do not pretend to be anything else - your attitude here is far worse.

    Disregard my personal message and simply leave as you said you would in another post. I doubt it's me who needs all the help they can get.



  • I've got to give you guys points for making possibly the strangest thread I've ever read. It seems like it's going on at least three different levels: Two shall we say "questionably funny" in-jokes, and possibly one level of seriousness. Enjoy yourselves, whoever is in on the joke(s).



  • @Otterdam said:

    @morbiuswilters said:

    I guess I misread you, Otterdam. 
     

    Yes, yes, you did. Now you leave me very confused.

     <snip>

    I would ask you to reconsider, but after your condescending attitude
    telling me 'I need all the help I can get' and saying more prayers than
    usual, I hardly think it worth it. At least insults do not pretend to
    be anything else - your attitude here is far worse.

    Disregard my personal message and simply leave as you said you would in another post. I doubt it's me who needs all the help they can get.

    Not that this is any of my business, but you really seem to be taking this thread seriously.  Assuming that you've read some of the forum regulars' posts in other threads: By any chance, have you noticed anyone acting out of character here, so to speak?  Has anyone been using stilted, overly formal and polite language, where they would normally be swearing and making jokes?  Do certain forum regulars appear to be squabbling amongst themselves, when they usually feed off each others' jokes?

    If that is not enough of a clue for you:

    @morbiuswilters said:

     

     I figured you were one of the people fed up with the childish turn this forum has taken in the last 3.5 months.

     

     And maybe you should take another look at the first couple of posts that started this "flamewar":

    @PSWorx said:

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

    @morbiuswilters said:

    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.

    Final hint: if you look at this thread and take pretty much every post not written by you, starting with morbiuswilters quoted post above, and surround it with gigantic SARCASM tags, the entire thing would make a lot more sense....

    Final-est hint:  morbiuswilters obviously disagrees with PSWorx's assessment of the others, he expressed it in the most sarcastic way possible, and the others jumped in to play along for laughs....

    (Obviously I spend waaaay too much time lurking on these forums....)



  • You ruined the joke, idiot! 



  • @Otterdam said:

    You ruined the joke, idiot! 

     

    Uh, okay.  It wasn't all that clear to me you were in on the joke, whereas it seemed obvious for the others.  You played it so straight that you had me fooled.  My bad! 



  • @CodeSimian said:

    Uh, okay.  It wasn't all that clear to me you were in on the joke, whereas it seemed obvious for the others.  My bad! 
     

    No, just kidding. It was serious and I am still angered and outraged.



  • @Otterdam said:

    @CodeSimian said:

    Uh, okay.  It wasn't all that clear to me you were in on the joke, whereas it seemed obvious for the others.  My bad! 
     

    No, just kidding. It was serious and I am still angered and outraged.

     

    Uh...okay?   Now I am seriously doubting whether you were in on their original joke or not.  Is that a half-hearted attempt to restart the joke, a lighthearted jab at me, or are you seriously angered and outraged?

    Seeing as I've ruined the joke a thousandfold by now, feel free to answer seriously.

    (BTW, my "TRWTF is not having a sense of humour" was directed at my own post and myself, not your post, in case you are reacting to that tag.)

    EDIT: I am going to assume you were just kidding about being angered and outraged.  Obviously I am the only one stupid enough to take anything in this thread seriously....



  • Okay, anyone who isn't actually on the same side, please raise your hand.  Just so the rest of us can see what's actually going on here. 


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.