Im using the following code to read to consumer_key and consumer_secret from config.php, pass it to twitter and retrieve some bits of information back
consumer_key
consumer_secret
In your second script, it looks like you aren't setting the Consumer Key and Consumer Secret when you create your TwitterOAuth instance.
// Initiate a TwitterOAuth using those access tokens $oauth = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token, $access_token_secret);