Jump to content

itsjimmy91

New Members
  • Posts

    4
  • Joined

  • Last visited

itsjimmy91's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello... I simply am running a query with the Twitter Search API that searches for a specific term and then returns the Tweets it finds. This is a sample of what the array of Tweets returned looks like: array(50) { [0]=> object(stdClass)#9 (18) { ["created_at"]=> string(31) "Tue, 11 Dec 2012 04:30:08 +0000" ["from_user"]=> string(7) "Cvpcake" ["from_user_id"]=> int(44610318) ["from_user_id_str"]=> string( "44610318" ["from_user_name"]=> string(6) "KILLER" ["geo"]=> NULL ["id"]=> float(2.7835596410783E+17) ["id_str"]=> string(18) "278355964107829248" ["iso_language_code"]=> string(2) "en" ["metadata"]=> object(stdClass)#10 (1) { ["result_type"]=> string(6) "recent" } ["profile_image_url"]=> string(90) "http://a0.twimg.com/profile_images/2945542955/d437253418ea0ae75efb5ae6bf5cec1e_normal.jpeg" ["profile_image_url_https"]=> string(92) "https://si0.twimg.com/profile_images/2945542955/d437253418ea0ae75efb5ae6bf5cec1e_normal.jpeg" ["source"]=> string(89) "<a href="http://twitter.com/download/iphone">Twitter for iPhone</a>" ["text"]=> string(57) "RT @DJNickatNIte_: 9 weeks test ain't got shit on #FINALS" ["to_user"]=> NULL ["to_user_id"]=> int(0) ["to_user_id_str"]=> string(1) "0" ["to_user_name"]=> NULL } [1]=> object(stdClass)#11 (18) { ["created_at"]=> string(31) "Tue, 11 Dec 2012 04:30:07 +0000" ["from_user"]=> string( "BaboTina" ["from_user_id"]=> int(224918169) ["from_user_id_str"]=> string(9) "224918169" ["from_user_name"]=> string(4) "Tina" ["geo"]=> NULL ["id"]=> float(2.783559623588E+17) ["id_str"]=> string(18) "278355962358796288" ["iso_language_code"]=> string(2) "en" ["metadata"]=> object(stdClass)#12 (1) { ["result_type"]=> string(6) "recent" } ["profile_image_url"]=> string(89) "http://a0.twimg.com/profile_images/2936213945/390fe03b68949baa1bb1af2f2d6fe76e_normal.png" ["profile_image_url_https"]=> string(91) "https://si0.twimg.com/profile_images/2936213945/390fe03b68949baa1bb1af2f2d6fe76e_normal.png" ["source"]=> string(91) "<a href="http://twitter.com/download/android">Twitter for Android</a>" ["text"]=> string(130) "RT @autocorrects: Multiple choice (test): A, B, C, or D? “Well I haven’t had a B for like 4 questions so I’ll choose that”" ["to_user"]=> NULL ["to_user_id"]=> int(0) ["to_user_id_str"]=> string(1) "0" ["to_user_name"]=> NULL } [2]=> object(stdClass)#13 (18) { ["created_at"]=> string(31) "Tue, 11 Dec 2012 04:30:07 +0000" ["from_user"]=> string(13) "SyifaGBastian" ["from_user_id"]=> int(332078990) ["from_user_id_str"]=> string(9) "332078990" ["from_user_name"]=> string(12) "ViscaELBarca" ["geo"]=> NULL ["id"]=> float(2.7835596214069E+17) ["id_str"]=> string(18) "278355962140688385" ["iso_language_code"]=> string(3) "und" ["metadata"]=> object(stdClass)#14 (1) { ["result_type"]=> string(6) "recent" } ["profile_image_url"]=> string(90) "http://a0.twimg.com/profile_images/2921649342/1a38717324614fad5993dc5e4383a925_normal.jpeg" ["profile_image_url_https"]=> string(92) "https://si0.twimg.com/profile_images/2921649342/1a38717324614fad5993dc5e4383a925_normal.jpeg" ["source"]=> string(59) "<a href="http://twitter.com/">web</a>" ["text"]=> string(4) "test" ["to_user"]=> NULL ["to_user_id"]=> int(0) ["to_user_id_str"]=> string(1) "0" ["to_user_name"]=> NULL } Now what I want to do is store the "id_str" field of each Tweet into an array. I'm trying to do this and I thought it would be simple, but I must be doing something wrong. Here is what I have, which results in an error. $tweetIds; // loop through $results and favorite them for($i=0; $i<3; $i++) { $tweetIds[$i] => $results[$i]['id_str']; } I've tried a couple of other things, including... $tweetIds; // loop through $results and favorite them for($i=0; $i<3; $i++) { $tweetIds[$i] => $results[$i]["id_str"]; } and... $tweetIds; // loop through $results and favorite them for($i=0; $i<3; $i++) { $tweetIds[$i] => $results[$i][7]; } But each way has resulted in an error. I can't figure out why. I'm sure it's something simple I'm not doing correctly... thanks for any help
  2. oof .. I guess that was a rookie mistake. The View Source actually helps a ton, hopefully I can figure it out with that. Thank you.
  3. Hm.. ok. I didn't know about var_dump(), that's definitely a helpful thing to know. Thanks for that. This is what shows on the var_dump of $creds... object(EpiTwitterJson)#7 (1) { ["resp":"EpiTwitterJson":private]=> object(EpiCurlManager)#8 (2) { ["key":"EpiCurlManager":private]=> string(14) "Resource id #8" ["epiCurl":"EpiCurlManager":private]=> object(EpiCurl)#2 (6) { ["mc":"EpiCurl":private]=> resource(5) of type (curl_multi) ["msgs":"EpiCurl":private]=> NULL ["running":"EpiCurl":private]=> NULL ["requests":"EpiCurl":private]=> array(3) { ["Resource id #6"]=> resource(6) of type (curl) ["Resource id #7"]=> resource(7) of type (curl) ["Resource id #8"]=> resource( of type (curl) } ["responses":"EpiCurl":private]=> array(2) { ["Resource id #6"]=> array(5) { ["data"]=> string(167) "oauth_token=281896160-64tXSSB0Wd8qkw8HgvL125VBWyQN3zCigkfXb2ZY&oauth_token_secret=ZF9hnkCMRlRbnSZvIZEYCshqrLuR79paa4Vc1M8EyzQ&user_id=281896160&screen_name=jimmyhalter" ["code"]=> int(200) ["time"]=> float(0.29566) ["length"]=> float(167) ["type"]=> string(24) "text/html; charset=utf-8" } ["Resource id #7"]=> array(5) { ["data"]=> string(68) "{"errors":[{"message":"Sorry, that page does not exist","code":34}]}" ["code"]=> int(404) ["time"]=> float(0.115966) ["length"]=> float(68) ["type"]=> string(31) "application/json; charset=utf-8" } } ["properties":"EpiCurl":private]=> array(4) { ["code"]=> int(2097154) ["time"]=> int(3145731) ["length"]=> int(3145743) ["type"]=> int(1048594) } } } } I'm really not sure what to do with this.
  4. Hey guys. I'm new here and pretty new to PHP. I know the basics of the language and can do most simple things, but I am working with Twitter in a project now and I have never worked with it before in terms of PHP. I have a PHP page that simply provides a link that the user clicks on to go to the Twitter page where they are asked to grant access to my application to use their Twitter. I do this through oAuth and this works as it should, returning a token. Upon granting access, a user is sent to a new PHP page which simply asks them to enter a search term. Once they enter a search term, I want to take that term and simply run it through the Twitter Search API. I then want to grab all of the IDs of the Tweets returned and store them. Here is the code that I have: <?php session_start(); ob_start(); include 'lib/EpiCurl.php'; include 'lib/EpiOAuth.php'; include 'lib/EpiTwitter.php'; include 'lib/secret.php'; $oauth_token = $_POST['authtoken']; $search = $_POST['searchterm']; $tweets = $_POST['tweets']; $url = 'http://api.search.twitter.com/search.json?q='.$searchterm; $twitterObj = new EpiTwitter($consumer_key, $consumer_secret); $twitterObj->setToken($oauth_token); $token = $twitterObj->getAccessToken(); $twitterObj->setToken($token->oauth_token, $token->oauth_token_secret); $_SESSION['ot'] = $token->oauth_token; $_SESSION['ots'] = $token->oauth_token_secret; $twitterInfo = $twitterObj->get_accountVerify_credentials(); $twitterInfo->response; $creds = $twitterObj->get($url); ?> Now I'm stuck with what $creds is actually holding and how I will get the Tweet ID's out of it. I've tried a bunch of echo statements to attempt to figure it out, but I can't seem to get it. I feel like I'm close. Thanks for any help.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.