Paying for Answers
09 Mar 2007I've been subscribed to the general PHP mailing list for many years. I used to be very active, answering hundreds of questions a month, but lately my participation has dropped. While scanning through my backlog of email earlier, one subject caught my eye:
$35 to the first person who can do this XML-parsing PHP script
I was curious enough to open the email and read further:
I'll send $35 to someone via Paypal who can create a PHP script that will do the following:
- Read XML data from a URL (librarytools.com/events/sampledata.txt)
- Loop through all XML results and print to the screen the eventname and eventnextoccurrencedate (just the date) values.
To my surprise, no one had responded, so I decided to quickly provide a solution. I wasn't expecting to be paid, but I couldn't resist calling someone's bluff, especially since I knew SimpleXML would make this a 5-minute problem, regardless of what the XML document looked like. A few minutes later, I responded:
<table><tr><th>Name</th><th>Date</th></tr><?php$xml = simplexml_load_file('http://librarytools.com/events/sampledata.txt');foreach ($xml->source->result as $f) {$name = '?';$date = '?';foreach ($f as $value) {if ($value['n'] == 'eventname') {$name = $value;} elseif ($value['n'] == 'eventnextoccurrencedate') {$date = date('D, d M Y H:i:s', strtotime($value));}}echo " <tr><td>{$name}</td><td>{$date}</td></tr>\n";}?></table>
I don't bring this up to extol the virtues of SimpleXML. I'm more interested in exploring the idea of paying for answers.
Paying for answers isn't a new idea (even Google has experimented with it), but I can't think of a success story. Can you?