Close

AlternativelyOther methods of signing in.

 
lock and key

Sign in to your dor.ky account.

Account Login

Slide 1 Slide 2 Slide 3 Slide 4 Slide 5 Slide 6 Slide 7 Slide 8 Slide 9

I'm a web developer, data lover, urban explorer, geocacher and open source advocate currently in beautiful Staffordshire, England.

Thursday 26th August 2010

5 Comments

Not So Much a Record

You can always tell when it is the GCSE results time of the year for teenagers. The media goes into overdrive about how wonderful it is more people have passed their exams than before and the drivel that goes along with the story that dominates for a few weeks. My issue with this comes in the fact that I’m pretty sure more teenagers are ‘passing’ exams not due to gaining intellect but rather the dumbing down of exam papers.

In this day and age it seems to be more important that we don’t offend the pupils that aren’t doing too well rather than pushing them harder to improve themselves. When I was younger I wouldn’t stop attempting to do something until I’d learned to do it successfully. That is part of life, part of learning and part of what growing up is about.

For the majority, it seems more in this day and age that the mindset of a pupil is completely different to that of when I was their age. I’m not one in a million and I’m not exceptionally intelligent, but that never stopped me trying to better myself and learn more. It sadly seems now that most of the kids in school are happy just stay at the level they are at because it is a lot more comfortable that way. Of course, that’s comfortable in the sense of growing up and ending up on the dole living off the tax-payer.

Saturday 21st August 2010

No Comments

Twitter API Oauth Update Status

This PHP script will post an update to Twitter using OAuth. You can download the complete script and library here.

The Actual Script

  1. #!/usr/bin/php
  2. <?php
  3. // Twitter Status Update via Oauth
  4. // By Scott Wilcox (v0.1) http://dor.ky
  5. //
  6. // This script is a basic script that will post an update to 
  7. // Twitter using OAuth. (Basic Auth is being deprecated at 
  8. // the moment). You'll need to chmod +x this to run CLI.
  9.  
  10. // This script uses the fantastic twitter-async library
  11. // which was created by jmathai. You can get the latest news 
  12. // and updates for that over at Github using the following url 
  13. // http://github.com/jmathai/twitter-async
  14. require "lib/EpiCurl.php";
  15. require "lib/EpiOAuth.php";
  16. require "lib/EpiTwitter.php";
  17.  
  18. // You need to fetch these OAuth tokens and save them for use
  19. // within the OAuth calls. To get these values you will need
  20. // to create a new 'app' at http://dev.twitter.com/apps
  21. //
  22. // You can find CONSUMER_KEY and CONSUMER_SECRET on your apps
  23. // 'Application Details' page, and you can find USER_TOKEN and
  24. // USER_SECRET on the 'My Access Token' page.
  25. define(CONSUMER_KEY,"Replace with your Consumer Key");
  26. define(CONSUMER_SECRET,"Replace with your Consumer Secret");
  27. define(USER_TOKEN,"Replace with 'My Access Token' Oauth token");
  28. define(USER_SECRET,"Replace with 'My Access Token' Oauth secret");
  29.  
  30. // If there was a command line argument passed, we can use that as
  31. // the status update text, else print an error out
  32. if ($_SERVER["argv"][1]) {
  33. 	// Format text as utf8 and chomp at 140 chars
  34. 	$text = utf8_encode(substr($_SERVER["argv"][1],0,140));
  35.  
  36. 	$twitterObj = new EpiTwitter(CONSUMER_KEY,CONSUMER_SECRET,USER_TOKEN,USER_SECRET);
  37. 	$x = $twitterObj->post_statusesUpdate(array('status' => $text));
  38. 	if ($x->id) {
  39. 		echo "Tweet Posted: ".$x->id."n";
  40. 	} else {
  41. 		echo "Error Posting Tweetn";	
  42. 	}	
  43. } else {
  44. 	echo "Usage: ./twitter.php 'My status update goes here'n";
  45. }
  46. ?>

 

Running the Script

 

The End Product

 

Older Entries

You can read previous entries or view the archives.