How can i store my tweet in to database


#1

hello all

any one tell me how can i store twitter tweet into my database.


#2

Hi.,
For storing twitter tweets, NoSQL db is preferrable like mongodb,cassandra,elastic search…
Otherwise., identify the fixed properties and define schema (its not preferrable for most applications)


#3

i create one application in twitter and display all tweet list now my question is that how can i store them in to MYSQL DB . can you give me some example


#4

Here, the example:

I have 2 tweets., they have different set of schema…

{
“created_at”: “Tue Nov 12 05:17:52 +0000 2013”,
“id”: 400130302988660740,
“id_str”: “400130302988660736”,
“text”: “Pragmatic RESTful API Design: Apigee Webinar by @Apigee #api #apigee http://t.co/YFgw8m3ycG via @SlideShare”,
“source”: “Tweet Button”,
“truncated”: false,
“in_reply_to_status_id”: null,
“in_reply_to_status_id_str”: null,
“in_reply_to_user_id”: null,
“in_reply_to_user_id_str”: null,
“in_reply_to_screen_name”: null,
“user”: {},
“geo”: null,
“coordinates”: null,
“place”: null,
“contributors”: null,
“retweet_count”: 1,
“favorite_count”: 1,
“entities”: {},
“favorited”: false,
“retweeted”: false,
“possibly_sensitive”: false,
“lang”: “id”
},

{
“created_at”: “Mon Nov 18 07:04:42 +0000 2013”,
“id”: 402331514270019600,
“id_str”: “402331514270019584”,
“text”: “RT @timesofindia: #Nasa aims for #Mars, robotic #Maven set to soar http://t.co/VwCM5wLVS7”,
“source”: “Twitter Web Client”,
“truncated”: false,
“in_reply_to_status_id”: null,
“in_reply_to_status_id_str”: null,
“in_reply_to_user_id”: null,
“in_reply_to_user_id_str”: null,
“in_reply_to_screen_name”: null,
“user”: {},
“geo”: null,
“coordinates”: null,
“place”: null,
“contributors”: null,
“retweeted_status”: {},
“retweet_count”: 1,
“favorite_count”: 0,
“entities”: {},
“favorited”: false,
“retweeted”: true,
“possibly_sensitive”: false,
“lang”: “en”
},


#5

hello Nagendra
i installed mongodb .now i have one question where i store example.php file and what is url for this php file in front side…?
just like a localhost/folder/example.php


#6

Hi.,
i am not understanding what is your requirement exactly. What is example.php


#7
<?php try { // open connection to MongoDB server $conn = new Mongo('localhost'); // access database $db = $conn->test; // access collection $collection = $db->items; // insert a new document $item = array( 'name' => 'milk', 'quantity' => 10, 'price' => 2.50, 'note' => 'skimmed and extra tasty' ); $collection->insert($item); echo 'Inserted document with ID: ' . $item['_id']; // disconnect from server $conn->close(); } catch (MongoConnectionException $e) { die('Error connecting to MongoDB server'); } catch (MongoException $e) { die('Error: ' . $e->getMessage()); } ?>

i just create simple php file and store into mongodb database but i dont know where to place it and how to run it in browser


#8

it is an example of localhost with mysql in wamp sarver that display php file got it…?
now my question is that how we can do in mongodb


#9

hello nagendra
i successfully run mongodb with php. can you give me example how to store tweet in to mongodb using php reply me as soon as possible.
thanks