You may like to know that you can make your server show errors by using either "ini_set('display_errors', 'On');" or setting display_errors to On in your php.ini. Also check error_reporting, set it to E_ALL for optimal debugging.

Tom


On 1/4/11 6:47 AM, Dave The Happy Singer wrote:
Aha! Problem solved!

As you noted, print_r($v) wasn't printing anything. Moving print_r($t)
to after the get() call wiped all output but '<pre>'.

The problem? For some reason, my PHP installation wasn't displaying
errors. A look in the apache log revealed that this was masking 'Fatal
error: Call to undefined function: curl_init()'.

Installing php5-curl and rebooting solved my problem, and now I appear
to be in business.

Thank you ever so much for your time, Abraham. I wonder if it would be
an idea for your library to catch the failure of curl_init() and add an
error status to the object? No biggie, though. There was no-one to blame
but myself here; sorry!

Dave
(@HappySinger)

On 4 January 2011 16:08, Abraham Williams <4bra...@gmail.com
<mailto:4bra...@gmail.com>> wrote:

    Try printing $t after you make the get request. Where you are
    printing $t now it doesn't contain any info from the actual request.
    I also don't see anything printed from $v. $v should be printing any
    error messages returned from Twitter. If $v is not printing anything
    or http_code is 0 then your server is probably are able to connect
    to https://api.twitter.com.

    Abraham
    -------------
    Abraham Williams | Hacker Advocate | abrah.am <http://abrah.am>
    @abraham <https://twitter.com/abraham> | github.com/abraham
    <https://github.com/abraham> | blog.abrah.am <http://blog.abrah.am>
    This email is: [ ] shareable [x] ask first [ ] private.



    On Mon, Jan 3, 2011 at 20:26, Dave The Happy Singer
    <sm...@davethehappysinger.com <mailto:sm...@davethehappysinger.com>>
    wrote:

        Hi there,

        Based on the instructions at: https://gist.github.com/564882, I
        am trying to set up the TwitterOAuth object, but I seem to be
        falling at the first hurdle, even before I try authenticating
        another user.

        With the code:

        <pre>
        <?php
                 error_reporting(E_ALL);
                 require_once('twitteroauth/twitteroauth.php');
                 require_once('config.php');
                 $t = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET,
        OAUTH_TOKEN, OAUTH_TOKEN_SECRET);

                 print_r($t);
                 $v = $t->get('account/verify_credentials');
                 print_r($v);
        ?>
        </pre>

        I am getting the following output:

        TwitterOAuth Object
        (
             [http_code] =>
             [url] =>
             [host] => https://api.twitter.com/1/
             [timeout] => 30
             [connecttimeout] => 30
             [ssl_verifypeer] =>
             [format] => json
             [decode_json] => 1
             [http_info] =>
             [useragent] => TwitterOAuth v0.2.0-beta2
             [sha1_method] => OAuthSignatureMethod_HMAC_SHA1 Object
                 (
                 )

             [consumer] => OAuthConsumer Object
                 (
                     [key] => <apparently correct>
                     [secret] => <apparently correct>
                     [callback_url] =>
                 )

             [token] => OAuthConsumer Object
                 (
                     [key] => <apparently correct>
                     [secret] => <apparently correct>
                     [callback_url] =>
                 )

        )

        As you can see, I am not getting the methods 'get', 'post' etc.
        in my object $t when I instantiate it, and I can go no further.

        I'm confuzzled, and would be grateful for any tips!

        Dave

        --
        Twitter developer documentation and resources:
        http://dev.twitter.com/doc
        API updates via Twitter: http://twitter.com/twitterapi
        Issues/Enhancements Tracker:
        http://code.google.com/p/twitter-api/issues/list
        Change your membership to this group:
        http://groups.google.com/group/twitter-development-talk


    --
    Twitter developer documentation and resources:
    http://dev.twitter.com/doc
    API updates via Twitter: http://twitter.com/twitterapi
    Issues/Enhancements Tracker:
    http://code.google.com/p/twitter-api/issues/list
    Change your membership to this group:
    http://groups.google.com/group/twitter-development-talk


--
Twitter developer documentation and resources: http://dev.twitter.com/doc
API updates via Twitter: http://twitter.com/twitterapi
Issues/Enhancements Tracker:
http://code.google.com/p/twitter-api/issues/list
Change your membership to this group:
http://groups.google.com/group/twitter-development-talk

--
Twitter developer documentation and resources: http://dev.twitter.com/doc
API updates via Twitter: http://twitter.com/twitterapi
Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
http://groups.google.com/group/twitter-development-talk

Reply via email to