[twitter-dev] Re: Hello with OAuth connection

2011-03-27 Thread Jon
Can someone please help with the above code?

Thanks,

Jon

On Mar 25, 3:57 pm, Jon j...@whotweet.net wrote:
 Thanks... I should've posted the whole thing because now I'm getting
 another error! This is what I'm trying to do (I really appreciate your
 help!):

       ?php
      /* Load required lib files. */
      require_once('twitteroauth/twitteroauth.php'); /* This is the
 library for connecting with oAuth */
      require_once('config.php'); /* This is the file that contains
 the oAuth credentials - this will be different for each app */
     //$twitterUser = 'YOUR_FRIENDS_USERNAME';
     $twitterUser = $field_twitter_url;
      /* Create a TwitterOauth object with consumer/user tokens. */
      $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET,
 OAUTH_TOKEN, OAUTH_TOKEN_SECRET);
      $statuses = $connection-get('statuses/user_timeline',
 array('screen_name' = $twitterUser'));

      //create a time display like '1 hour ago'
      function twitterTime($time) {
            $delta = time() - $time;
            if ($delta  60) {
               return 'less than a minute ago.';
            } else if ($delta  120) {
              return 'about a minute ago.';
            } else if ($delta  (45 * 60)) {
              return floor($delta / 60) . ' minutes ago.';
            } else if ($delta  (90 * 60)) {
              return 'about an hour ago.';
            } else if ($delta  (24 * 60 * 60)) {
              return 'about ' . floor($delta / 3600) . ' hours ago.';
            } else if ($delta  (48 * 60 * 60)) {
              return '1 day ago.';
            } else {
              return floor($delta / 86400) . ' days ago.';
            }
      }
      //this is an empty string container we're going to pass the
 result of our loop into
      $twitterString = ;

                       foreach ($xml-status as $entry)
                       {

  // there are more elements to choose from 
 see:http://apiwiki.twitter.com/REST+API+Documentation#Statuselement
                   $status               = $entry-text;
                   $profilePic   = $entry-user-profile_image_url;
                   $profileName  = $entry-user-screen_name;
                   $statusRealName       = $entry-user-name;
                   $profileURL   = $entry-user-url;
                   $statusDate   = $entry-created_at;
                   $statusSource         = $entry-source;
                   $statusDateFormatted = twitterTime(strtotime($statusDate));
                   $profileBio   = $entry-user-description;
                   $statusFollowCount    = $entry-user-followers_count;

                   echo div class=\post hentry\\n;
                   echo div class=\image-box\\n;
                   echo img class=\photo\\n;
                   echo a href=\http://www.twitter.com/$profileName\; 
 target=
 \_blank\img class=\userPicThumb\ src=\$profilePic\ alt=
 \$profileRealName\ //a\n;
                   echo /div\n;
                   echo div class=\text-box\\n;
                   echo div class=\meta\\n;
                   echo strong class=\post-link\\n;
                   echo a class=\entry-title\ 
 href=\http://www.twitter.com/
 $profileName\ target=\_blank\$profileName/a\n;
                   echo /strong\n;
                   echo span class=\vcard\span class=\fn\ 
 $statusRealName/
 span/span\n;
                   echo /div\n;
                   echo p class=\entry-content\$status/p\n;
                   echo div class=\time\\n;
                   echo span$statusDateFormatted from 
 $statusSource/span\n;
                   echo /div\n;
                   echo /div\n;
                   echo div class=\clear\/div\n;
                   echo /span\n;
                   echo /div\n;

                       }
                  ?

 On Mar 25, 3:52 pm, Abraham Williams 4bra...@gmail.com wrote:







  Oops. I had a type. The = needs a  directly after it like =

  Abraham
  -
  Abraham Williams | Hacker Advocate | abrah.am
  http://abrah.amJust launched from Answerly http://answerly.com:
  InboxQhttp://inboxq.comfor Chrome
  @abraham https://twitter.com/abraham | github.com/abraham | blog.abrah.am
  This email is: [ ] shareable [x] ask first [ ] private.

  On Fri, Mar 25, 2011 at 15:44, Jon j...@whotweet.net wrote:
   Thanks Abraham,

   I'm getting an error on the last line there though:

   Parse error: syntax error, unexpected '=', expecting ')' in ...

   On Mar 25, 3:33 pm, Abraham Williams 4bra...@gmail.com wrote:
You are not formatting the GET request correctly and TwitterOAuth
automatically parses the JSON response for you.

?php
     /* Load required lib files. */
     require_once('twitteroauth/twitteroauth.php'); /* This is the
library for connecting with oAuth */
     require_once('config.php'); /* This is the file that contains
the oAuth credentials - this will be different for each app */

    //$twitterUser = 'YOUR_FRIENDS_USERNAME';
    

[twitter-dev] Re: Hello with OAuth connection

2011-03-27 Thread Blaaze
what exactly you want to implement, am a freelancer and you can hire
me at good rates.

-- 
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-dev] Re: Hello with OAuth connection

2011-03-27 Thread Jon
All I'm trying to do is pull the user timeline or latest tweets for a
given user that I follow. I think I have the code 99% correct, but I
am horrible with PHP and am getting an error: Parse error: syntax
error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')'

Can someone please let me know where my error may be?

Thanks,

Jon

On Mar 27, 9:12 am, Blaaze blaazet...@gmail.com wrote:
 what exactly you want to implement, am a freelancer and you can hire
 me at good rates.

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


Re: [twitter-dev] Re: Hello with OAuth connection

2011-03-27 Thread Blaaze Artifex
can you post the exact code and exact error that you are seeing on your
browser

On Sun, Mar 27, 2011 at 11:38 PM, Jon j...@whotweet.net wrote:

 All I'm trying to do is pull the user timeline or latest tweets for a
 given user that I follow. I think I have the code 99% correct, but I
 am horrible with PHP and am getting an error: Parse error: syntax
 error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')'

 Can someone please let me know where my error may be?

 Thanks,

 Jon

 On Mar 27, 9:12 am, Blaaze blaazet...@gmail.com wrote:
  what exactly you want to implement, am a freelancer and you can hire
  me at good rates.

 --
 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-dev] Re: Hello with OAuth connection

2011-03-27 Thread Jon
The exact code is posted above... you can see the error here:
http://realestateagentswhotweet.com/kristan-cole/

I think it's something structurally though with the PHP, as line 65
itself should be fine, it's just the standard time display code below:

 //create a time display like '1 hour ago'
 function twitterTime($time) {
   $delta = time() - $time;
   if ($delta  60) {
  return 'less than a minute ago.';
   } else if ($delta  120) {
 return 'about a minute ago.';
   } else if ($delta  (45 * 60)) {
 return floor($delta / 60) . ' minutes ago.';
   } else if ($delta  (90 * 60)) {
 return 'about an hour ago.';
   } else if ($delta  (24 * 60 * 60)) {
 return 'about ' . floor($delta / 3600) . ' hours ago.';
   } else if ($delta  (48 * 60 * 60)) {
 return '1 day ago.';
   } else {
 return floor($delta / 86400) . ' days ago.';
   }
 }


I don't think the error is from the above, it's something structurally
above or below this code. Am I missing some brackets or something
somewhere? I'm not good enough with PHP to be able to tell.

Thanks,

Jon
On Mar 27, 10:14 am, Blaaze Artifex blaazet...@gmail.com wrote:
 can you post the exact code and exact error that you are seeing on your
 browser







 On Sun, Mar 27, 2011 at 11:38 PM, Jon j...@whotweet.net wrote:
  All I'm trying to do is pull the user timeline or latest tweets for a
  given user that I follow. I think I have the code 99% correct, but I
  am horrible with PHP and am getting an error: Parse error: syntax
  error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')'

  Can someone please let me know where my error may be?

  Thanks,

  Jon

  On Mar 27, 9:12 am, Blaaze blaazet...@gmail.com wrote:
   what exactly you want to implement, am a freelancer and you can hire
   me at good rates.

  --
  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-dev] Re: Hello with OAuth connection

2011-03-27 Thread Blaaze
in this code above especially in your function twitterTime

please remove single quotes and replace them with double quotes and
also remove that first line of comment, then try it will work

-- 
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-dev] Re: Hello with OAuth connection

2011-03-27 Thread Jon
Thanks Blaze... I think we're getting closer, now the error is on like
78 (You can see it here: http://realestateagentswhotweet.com/kristan-cole/)

Here is the code:

?php get_header(); ?
div id=content class=hfeed
?php
if(function_exists('bcn_display'))
{
echo 'ul class=breadcrumbsli';
bcn_display();
echo '/li/ul';
}
?
?php dynamic_sidebar('page_top'); ?
?php if (have_posts()) : ?
!-- heading --
div class=heading-box
div class=heading
h1AGENT PROFILE/h1
/div
/div
?php while (have_posts()) : the_post();
//init custom fields
$pid = get_the_ID();
$field_about= get_post_meta($pid, field_about, true);
?
div class=text-section
pThe profile of ?php the_category(', '); ? 
real estate agent ?
php the_title(); ?./p
/div
div class=profile-box
div class=text-holder vcard
div class=name-holder
strong class=namespan 
class=fn?php the_title(); ? /
span/strong em class=joba href=http://www.twitter.com/?php
echo get_the_content(); ? target=_blank?php echo
get_the_content(); ?/a/em
/div
?php if($field_about): ?
p class=entry-content?php echo 
$field_about; ?/p
?php endif; ?
?php the_tags('div 
class=tagsspanAreas Served:/
spanulli', ',/lili', '/li/ul/div'); ?
/div
/div
?php endwhile; ?
!-- heading --
div class=heading-box
div class=heading
h2AGENT TWEETS/h2
/div
/div
div class=text-section
pThe latest tweets from ?php the_title(); ?. /p
/div
  ?php

 require_once(twitteroauth/twitteroauth.php);
 require_once(config.php);
 $twitterUser = get_the_content();

 $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET,
OAUTH_TOKEN, OAUTH_TOKEN_SECRET);
 $statuses = $connection-get(statuses/user_timeline,
array(screen_name = $twitterUser));

 function twitterTime($time) {
   $delta = time() - $time;
   if ($delta  60) {
  return less than a minute ago.;
   } else if ($delta  120) {
 return about a minute ago.;
   } else if ($delta  (45 * 60)) {
 return floor($delta / 60) .  minutes ago.;
   } else if ($delta  (90 * 60)) {
 return about an hour ago.;
   } else if ($delta  (24 * 60 * 60)) {
 return about  . floor($delta / 3600) .  hours ago.;
   } else if ($delta  (48 * 60 * 60)) {
 return 1 day ago.;
   } else {
 return floor($delta / 86400) .  days ago.;
   }
 }

 $twitterString = ;

  foreach ($xml-status as $entry)
  {


  $status   = $entry-text;
  $profilePic   = $entry-user-profile_image_url;
  $profileName  = $entry-user-screen_name;
  $statusRealName   = $entry-user-name;
  $profileURL   = $entry-user-url;
  $statusDate   = $entry-created_at;
  $statusSource = $entry-source;
  $statusDateFormatted = twitterTime(strtotime($statusDate));
  $profileBio   = $entry-user-description;
  $statusFollowCount= $entry-user-followers_count;

  echo div class=\post hentry\\n;
  echo div class=\image-box\\n;
  echo img class=\photo\\n;
  echo a href=\http://www.twitter.com/$profileName\; target=
\_blank\img class=\userPicThumb\ src=\$profilePic\ alt=
\$profileRealName\ //a\n;
  echo /div\n;
  echo div class=\text-box\\n;
  echo div class=\meta\\n;
  echo strong class=\post-link\\n;
  echo a class=\entry-title\ href=\http://www.twitter.com/
$profileName\ target=\_blank\$profileName/a\n;
  echo /strong\n;
  echo span class=\vcard\span class=\fn\ 
$statusRealName/
span/span\n;
  echo /div\n;
  echo p class=\entry-content\$status/p\n;
  echo 

Re: [twitter-dev] Re: Hello with OAuth connection

2011-03-27 Thread Abraham Williams
The variable name $xml was changed to $statuses further up and you didn't
change the later $xml to $statuses.

Abraham
-
Abraham Williams | Hacker Advocate | abrah.am
 http://abrah.amJust launched from Answerly http://answerly.com:
InboxQhttp://inboxq.comfor Chrome
@abraham https://twitter.com/abraham | github.com/abraham | blog.abrah.am
This email is: [ ] shareable [x] ask first [ ] private.



On Sun, Mar 27, 2011 at 15:15, Jon j...@whotweet.net wrote:

 Thanks Blaze... I think we're getting closer, now the error is on like
 78 (You can see it here: http://realestateagentswhotweet.com/kristan-cole/
 )

 Here is the code:

 ?php get_header(); ?
div id=content class=hfeed
?php
if(function_exists('bcn_display'))
{
echo 'ul class=breadcrumbsli';
bcn_display();
echo '/li/ul';
}
?
?php dynamic_sidebar('page_top'); ?
?php if (have_posts()) : ?
!-- heading --
div class=heading-box
div class=heading
h1AGENT PROFILE/h1
/div
/div
?php while (have_posts()) : the_post();
//init custom fields
$pid = get_the_ID();
$field_about= get_post_meta($pid, field_about, true);
?
div class=text-section
pThe profile of ?php the_category(', ');
 ? real estate agent ?
 php the_title(); ?./p
/div
div class=profile-box
div class=text-holder vcard
div class=name-holder
strong class=namespan
 class=fn?php the_title(); ? /
 span/strong em class=joba href=http://www.twitter.com/?php
 echo get_the_content(); ? target=_blank?php echo
 get_the_content(); ?/a/em
/div
?php if($field_about): ?
p class=entry-content?php echo
 $field_about; ?/p
?php endif; ?
?php the_tags('div
 class=tagsspanAreas Served:/
 spanulli', ',/lili', '/li/ul/div'); ?
/div
/div
?php endwhile; ?
!-- heading --
div class=heading-box
div class=heading
h2AGENT TWEETS/h2
/div
/div
div class=text-section
pThe latest tweets from ?php the_title(); ?.
 /p
/div
  ?php

 require_once(twitteroauth/twitteroauth.php);
 require_once(config.php);
 $twitterUser = get_the_content();

 $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET,
 OAUTH_TOKEN, OAUTH_TOKEN_SECRET);
 $statuses = $connection-get(statuses/user_timeline,
 array(screen_name = $twitterUser));

 function twitterTime($time) {
   $delta = time() - $time;
   if ($delta  60) {
  return less than a minute ago.;
   } else if ($delta  120) {
 return about a minute ago.;
   } else if ($delta  (45 * 60)) {
 return floor($delta / 60) .  minutes ago.;
   } else if ($delta  (90 * 60)) {
 return about an hour ago.;
   } else if ($delta  (24 * 60 * 60)) {
 return about  . floor($delta / 3600) .  hours ago.;
   } else if ($delta  (48 * 60 * 60)) {
 return 1 day ago.;
   } else {
  return floor($delta / 86400) .  days ago.;
}
 }

 $twitterString = ;

  foreach ($xml-status as $entry)
  {


   $status   = $entry-text;
  $profilePic   = $entry-user-profile_image_url;
  $profileName  = $entry-user-screen_name;
  $statusRealName   = $entry-user-name;
  $profileURL   = $entry-user-url;
  $statusDate   = $entry-created_at;
  $statusSource = $entry-source;
  $statusDateFormatted =
 twitterTime(strtotime($statusDate));
  $profileBio   = $entry-user-description;
  $statusFollowCount= $entry-user-followers_count;

  echo div class=\post hentry\\n;
  echo div class=\image-box\\n;
  echo img class=\photo\\n;
  echo a href=\http://www.twitter.com/$profileName\;
 target=
 \_blank\img class=\userPicThumb\ src=\$profilePic\ alt=
 \$profileRealName\ //a\n;
  echo /div\n;
 

[twitter-dev] Re: Hello with OAuth connection

2011-03-27 Thread Jon
Thanks Abraham, I changed it to $satuses, but will get the same error
on that line: Warning: Invalid argument supplied for foreach() in ...
on line 78

On Mar 27, 5:36 pm, Abraham Williams 4bra...@gmail.com wrote:
 The variable name $xml was changed to $statuses further up and you didn't
 change the later $xml to $statuses.

 Abraham
 -
 Abraham Williams | Hacker Advocate | abrah.am
  http://abrah.amJust launched from Answerly http://answerly.com:
 InboxQhttp://inboxq.comfor Chrome
 @abraham https://twitter.com/abraham | github.com/abraham | blog.abrah.am
 This email is: [ ] shareable [x] ask first [ ] private.







 On Sun, Mar 27, 2011 at 15:15, Jon j...@whotweet.net wrote:
  Thanks Blaze... I think we're getting closer, now the error is on like
  78 (You can see it here:http://realestateagentswhotweet.com/kristan-cole/
  )

  Here is the code:

  ?php get_header(); ?
         div id=content class=hfeed
                 ?php
                 if(function_exists('bcn_display'))
                 {
                         echo 'ul class=breadcrumbsli';
                         bcn_display();
                         echo '/li/ul';
                 }
                 ?
                 ?php dynamic_sidebar('page_top'); ?
                 ?php if (have_posts()) : ?
                 !-- heading --
                 div class=heading-box
                         div class=heading
                                 h1AGENT PROFILE/h1
                         /div
                 /div
                 ?php while (have_posts()) : the_post();
                 //init custom fields
                 $pid = get_the_ID();
                 $field_about    = get_post_meta($pid, field_about, true);
                 ?
                         div class=text-section
                                 pThe profile of ?php the_category(', ');
  ? real estate agent ?
  php the_title(); ?./p
                         /div
                         div class=profile-box
                                 div class=text-holder vcard
                                         div class=name-holder
                                                 strong class=namespan
  class=fn?php the_title(); ? /
  span/strong em class=joba href=http://www.twitter.com/?php
  echo get_the_content(); ? target=_blank?php echo
  get_the_content(); ?/a/em
                                         /div
                                         ?php if($field_about): ?
                                         p class=entry-content?php echo
  $field_about; ?/p
                                         ?php endif; ?
                                         ?php the_tags('div
  class=tagsspanAreas Served:/
  spanulli', ',/lili', '/li/ul/div'); ?
                                 /div
                         /div
                 ?php endwhile; ?
                 !-- heading --
                 div class=heading-box
                         div class=heading
                                 h2AGENT TWEETS/h2
                         /div
                 /div
                 div class=text-section
                         pThe latest tweets from ?php the_title(); ?.
  /p
                 /div
       ?php

      require_once(twitteroauth/twitteroauth.php);
      require_once(config.php);
      $twitterUser = get_the_content();

      $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET,
  OAUTH_TOKEN, OAUTH_TOKEN_SECRET);
      $statuses = $connection-get(statuses/user_timeline,
  array(screen_name = $twitterUser));

      function twitterTime($time) {
            $delta = time() - $time;
            if ($delta  60) {
               return less than a minute ago.;
            } else if ($delta  120) {
              return about a minute ago.;
            } else if ($delta  (45 * 60)) {
              return floor($delta / 60) .  minutes ago.;
            } else if ($delta  (90 * 60)) {
              return about an hour ago.;
            } else if ($delta  (24 * 60 * 60)) {
              return about  . floor($delta / 3600) .  hours ago.;
            } else if ($delta  (48 * 60 * 60)) {
              return 1 day ago.;
            } else {
               return floor($delta / 86400) .  days ago.;
             }
      }

      $twitterString = ;

                       foreach ($xml-status as $entry)
                       {

                    $status               = $entry-text;
                   $profilePic   = $entry-user-profile_image_url;
                   $profileName  = $entry-user-screen_name;
                   $statusRealName       = $entry-user-name;
                   $profileURL   = $entry-user-url;
                   $statusDate   = $entry-created_at;
                   $statusSource         = $entry-source;
                   $statusDateFormatted =
  twitterTime(strtotime($statusDate));
                   $profileBio   = $entry-user-description;
                   $statusFollowCount    = $entry-user-followers_count;

              

Re: [twitter-dev] Re: Hello with OAuth connection

2011-03-27 Thread Abraham Williams
var_dump() the $statuses var to make sure it is what you expect and change
the foreach() as appropriate.

Abraham
-
Abraham Williams | Hacker Advocate | abrah.am
 http://abrah.amJust launched from Answerly http://answerly.com:
InboxQhttp://inboxq.comfor Chrome
@abraham https://twitter.com/abraham | github.com/abraham | blog.abrah.am
This email is: [ ] shareable [x] ask first [ ] private.



On Sun, Mar 27, 2011 at 17:50, Jon j...@whotweet.net wrote:

 Thanks Abraham, I changed it to $satuses, but will get the same error
 on that line: Warning: Invalid argument supplied for foreach() in ...
 on line 78

 On Mar 27, 5:36 pm, Abraham Williams 4bra...@gmail.com wrote:
  The variable name $xml was changed to $statuses further up and you didn't
  change the later $xml to $statuses.
 
  Abraham
  -
  Abraham Williams | Hacker Advocate | abrah.am
   http://abrah.amJust launched from Answerly http://answerly.com:
  InboxQhttp://inboxq.comfor Chrome
  @abraham https://twitter.com/abraham | github.com/abraham |
 blog.abrah.am
  This email is: [ ] shareable [x] ask first [ ] private.
 
 
 
 
 
 
 
  On Sun, Mar 27, 2011 at 15:15, Jon j...@whotweet.net wrote:
   Thanks Blaze... I think we're getting closer, now the error is on like
   78 (You can see it here:
 http://realestateagentswhotweet.com/kristan-cole/
   )
 
   Here is the code:
 
   ?php get_header(); ?
  div id=content class=hfeed
  ?php
  if(function_exists('bcn_display'))
  {
  echo 'ul class=breadcrumbsli';
  bcn_display();
  echo '/li/ul';
  }
  ?
  ?php dynamic_sidebar('page_top'); ?
  ?php if (have_posts()) : ?
  !-- heading --
  div class=heading-box
  div class=heading
  h1AGENT PROFILE/h1
  /div
  /div
  ?php while (have_posts()) : the_post();
  //init custom fields
  $pid = get_the_ID();
  $field_about= get_post_meta($pid, field_about,
 true);
  ?
  div class=text-section
  pThe profile of ?php the_category(',
 ');
   ? real estate agent ?
   php the_title(); ?./p
  /div
  div class=profile-box
  div class=text-holder vcard
  div class=name-holder
  strong
 class=namespan
   class=fn?php the_title(); ? /
   span/strong em class=joba href=http://www.twitter.com/?php
   echo get_the_content(); ? target=_blank?php echo
   get_the_content(); ?/a/em
  /div
  ?php if($field_about): ?
  p class=entry-content?php
 echo
   $field_about; ?/p
  ?php endif; ?
  ?php the_tags('div
   class=tagsspanAreas Served:/
   spanulli', ',/lili', '/li/ul/div'); ?
  /div
  /div
  ?php endwhile; ?
  !-- heading --
  div class=heading-box
  div class=heading
  h2AGENT TWEETS/h2
  /div
  /div
  div class=text-section
  pThe latest tweets from ?php the_title(); ?.
   /p
  /div
?php
 
   require_once(twitteroauth/twitteroauth.php);
   require_once(config.php);
   $twitterUser = get_the_content();
 
   $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET,
   OAUTH_TOKEN, OAUTH_TOKEN_SECRET);
   $statuses = $connection-get(statuses/user_timeline,
   array(screen_name = $twitterUser));
 
   function twitterTime($time) {
 $delta = time() - $time;
 if ($delta  60) {
return less than a minute ago.;
 } else if ($delta  120) {
   return about a minute ago.;
 } else if ($delta  (45 * 60)) {
   return floor($delta / 60) .  minutes ago.;
 } else if ($delta  (90 * 60)) {
   return about an hour ago.;
 } else if ($delta  (24 * 60 * 60)) {
   return about  . floor($delta / 3600) .  hours ago.;
 } else if ($delta  (48 * 60 * 60)) {
   return 1 day ago.;
 } else {
return floor($delta / 86400) .  days ago.;
  }
   }
 
   $twitterString = ;
 
foreach ($xml-status as $entry)
{
 
 $status  

[twitter-dev] Re: Hello with OAuth connection

2011-03-25 Thread Jon
Thanks Abraham,

I'm getting an error on the last line there though:

Parse error: syntax error, unexpected '=', expecting ')' in ...

On Mar 25, 3:33 pm, Abraham Williams 4bra...@gmail.com wrote:
 You are not formatting the GET request correctly and TwitterOAuth
 automatically parses the JSON response for you.

 ?php
      /* Load required lib files. */
      require_once('twitteroauth/twitteroauth.php'); /* This is the
 library for connecting with oAuth */
      require_once('config.php'); /* This is the file that contains
 the oAuth credentials - this will be different for each app */

     //$twitterUser = 'YOUR_FRIENDS_USERNAME';
     $twitterUser = $field_twitter_url;

      /* Create a TwitterOauth object with consumer/user tokens. */
      $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET,
 OAUTH_TOKEN, OAUTH_TOKEN_SECRET);

      $statuses = $connection-get('statuses/user_timeline',
 array('screen_name' = $twitterUser'));

 Abraham
 -
 Abraham Williams | Hacker Advocate | abrah.am
 http://abrah.amJust launched from Answerly http://answerly.com:
 InboxQhttp://inboxq.comfor Chrome
 @abraham https://twitter.com/abraham | github.com/abraham | blog.abrah.am
 This email is: [ ] shareable [x] ask first [ ] private.







 On Fri, Mar 25, 2011 at 14:50, Jon j...@whotweet.net wrote:
  Hello,

  I am having trouble with the below code... I am trying to pull a
  user's timeline. Can someone please let me know where I've gone wrong?

     ?php
       /* Load required lib files. */
       require_once('twitteroauth/twitteroauth.php'); /* This is the
  library for connecting with oAuth */
       require_once('config.php'); /* This is the file that contains
  the oAuth credentials - this will be different for each app */

      //$twitterUser = 'YOUR_FRIENDS_USERNAME';
      $twitterUser = $field_twitter_url;

       /* Create a TwitterOauth object with consumer/user tokens. */
       $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET,
  OAUTH_TOKEN, OAUTH_TOKEN_SECRET);

       $xml = $connection-get('statuses/user_timeline.xml?screen_name=
  $twitterUser');
       $xml = new SimpleXMLElement($xml);

  Thanks,

  Jon

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


Re: [twitter-dev] Re: Hello with OAuth connection

2011-03-25 Thread Abraham Williams
Oops. I had a type. The = needs a  directly after it like =

Abraham
-
Abraham Williams | Hacker Advocate | abrah.am
http://abrah.amJust launched from Answerly http://answerly.com:
InboxQhttp://inboxq.comfor Chrome
@abraham https://twitter.com/abraham | github.com/abraham | blog.abrah.am
This email is: [ ] shareable [x] ask first [ ] private.



On Fri, Mar 25, 2011 at 15:44, Jon j...@whotweet.net wrote:

 Thanks Abraham,

 I'm getting an error on the last line there though:

 Parse error: syntax error, unexpected '=', expecting ')' in ...

 On Mar 25, 3:33 pm, Abraham Williams 4bra...@gmail.com wrote:
  You are not formatting the GET request correctly and TwitterOAuth
  automatically parses the JSON response for you.
 
  ?php
   /* Load required lib files. */
   require_once('twitteroauth/twitteroauth.php'); /* This is the
  library for connecting with oAuth */
   require_once('config.php'); /* This is the file that contains
  the oAuth credentials - this will be different for each app */
 
  //$twitterUser = 'YOUR_FRIENDS_USERNAME';
  $twitterUser = $field_twitter_url;
 
   /* Create a TwitterOauth object with consumer/user tokens. */
   $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET,
  OAUTH_TOKEN, OAUTH_TOKEN_SECRET);
 
   $statuses = $connection-get('statuses/user_timeline',
  array('screen_name' = $twitterUser'));
 
  Abraham
  -
  Abraham Williams | Hacker Advocate | abrah.am
  http://abrah.amJust launched from Answerly http://answerly.com:
  InboxQhttp://inboxq.comfor Chrome
  @abraham https://twitter.com/abraham | github.com/abraham |
 blog.abrah.am
  This email is: [ ] shareable [x] ask first [ ] private.
 
 
 
 
 
 
 
  On Fri, Mar 25, 2011 at 14:50, Jon j...@whotweet.net wrote:
   Hello,
 
   I am having trouble with the below code... I am trying to pull a
   user's timeline. Can someone please let me know where I've gone wrong?
 
  ?php
/* Load required lib files. */
require_once('twitteroauth/twitteroauth.php'); /* This is the
   library for connecting with oAuth */
require_once('config.php'); /* This is the file that contains
   the oAuth credentials - this will be different for each app */
 
   //$twitterUser = 'YOUR_FRIENDS_USERNAME';
   $twitterUser = $field_twitter_url;
 
/* Create a TwitterOauth object with consumer/user tokens. */
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET,
   OAUTH_TOKEN, OAUTH_TOKEN_SECRET);
 
$xml = $connection-get('statuses/user_timeline.xml?screen_name=
   $twitterUser');
$xml = new SimpleXMLElement($xml);
 
   Thanks,
 
   Jon
 
   --
   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-dev] Re: Hello with OAuth connection

2011-03-25 Thread Jon
Thanks... I should've posted the whole thing because now I'm getting
another error! This is what I'm trying to do (I really appreciate your
help!):

  ?php
 /* Load required lib files. */
 require_once('twitteroauth/twitteroauth.php'); /* This is the
library for connecting with oAuth */
 require_once('config.php'); /* This is the file that contains
the oAuth credentials - this will be different for each app */
//$twitterUser = 'YOUR_FRIENDS_USERNAME';
$twitterUser = $field_twitter_url;
 /* Create a TwitterOauth object with consumer/user tokens. */
 $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET,
OAUTH_TOKEN, OAUTH_TOKEN_SECRET);
 $statuses = $connection-get('statuses/user_timeline',
array('screen_name' = $twitterUser'));

 //create a time display like '1 hour ago'
 function twitterTime($time) {
   $delta = time() - $time;
   if ($delta  60) {
  return 'less than a minute ago.';
   } else if ($delta  120) {
 return 'about a minute ago.';
   } else if ($delta  (45 * 60)) {
 return floor($delta / 60) . ' minutes ago.';
   } else if ($delta  (90 * 60)) {
 return 'about an hour ago.';
   } else if ($delta  (24 * 60 * 60)) {
 return 'about ' . floor($delta / 3600) . ' hours ago.';
   } else if ($delta  (48 * 60 * 60)) {
 return '1 day ago.';
   } else {
 return floor($delta / 86400) . ' days ago.';
   }
 }
 //this is an empty string container we're going to pass the
result of our loop into
 $twitterString = ;

  foreach ($xml-status as $entry)
  {



 // there are more elements to choose from see:
http://apiwiki.twitter.com/REST+API+Documentation#Statuselement
  $status   = $entry-text;
  $profilePic   = $entry-user-profile_image_url;
  $profileName  = $entry-user-screen_name;
  $statusRealName   = $entry-user-name;
  $profileURL   = $entry-user-url;
  $statusDate   = $entry-created_at;
  $statusSource = $entry-source;
  $statusDateFormatted = twitterTime(strtotime($statusDate));
  $profileBio   = $entry-user-description;
  $statusFollowCount= $entry-user-followers_count;

  echo div class=\post hentry\\n;
  echo div class=\image-box\\n;
  echo img class=\photo\\n;
  echo a href=\http://www.twitter.com/$profileName\; target=
\_blank\img class=\userPicThumb\ src=\$profilePic\ alt=
\$profileRealName\ //a\n;
  echo /div\n;
  echo div class=\text-box\\n;
  echo div class=\meta\\n;
  echo strong class=\post-link\\n;
  echo a class=\entry-title\ href=\http://www.twitter.com/
$profileName\ target=\_blank\$profileName/a\n;
  echo /strong\n;
  echo span class=\vcard\span class=\fn\ 
$statusRealName/
span/span\n;
  echo /div\n;
  echo p class=\entry-content\$status/p\n;
  echo div class=\time\\n;
  echo span$statusDateFormatted from $statusSource/span\n;
  echo /div\n;
  echo /div\n;
  echo div class=\clear\/div\n;
  echo /span\n;
  echo /div\n;


  }
 ?

On Mar 25, 3:52 pm, Abraham Williams 4bra...@gmail.com wrote:
 Oops. I had a type. The = needs a  directly after it like =

 Abraham
 -
 Abraham Williams | Hacker Advocate | abrah.am
 http://abrah.amJust launched from Answerly http://answerly.com:
 InboxQhttp://inboxq.comfor Chrome
 @abraham https://twitter.com/abraham | github.com/abraham | blog.abrah.am
 This email is: [ ] shareable [x] ask first [ ] private.







 On Fri, Mar 25, 2011 at 15:44, Jon j...@whotweet.net wrote:
  Thanks Abraham,

  I'm getting an error on the last line there though:

  Parse error: syntax error, unexpected '=', expecting ')' in ...

  On Mar 25, 3:33 pm, Abraham Williams 4bra...@gmail.com wrote:
   You are not formatting the GET request correctly and TwitterOAuth
   automatically parses the JSON response for you.

   ?php
        /* Load required lib files. */
        require_once('twitteroauth/twitteroauth.php'); /* This is the
   library for connecting with oAuth */
        require_once('config.php'); /* This is the file that contains
   the oAuth credentials - this will be different for each app */

       //$twitterUser = 'YOUR_FRIENDS_USERNAME';
       $twitterUser = $field_twitter_url;

        /* Create a TwitterOauth object with consumer/user tokens. */
        $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET,
   OAUTH_TOKEN, OAUTH_TOKEN_SECRET);