I have a return object coming from instagram. I am trying to skate the entire build DB table structure process, I understand Mongo is the ideal DB to use for this task.
I am using the regular instagram libraries https://github.com/cosenary/Instagram-PHP-API and my test code runs without error. I don have the PhP PECL mongo libraries installed, I should be good to go.
session_start();
require 'vendor/autoload.php';
use MetzWeb\Instagram\Instagram;
$instagram = new Instagram(array(
'apiKey' => 'xxx',
'apiSecret' => 'xxx',
'apiCallback' => 'http://103.238.173.97/success.php'
));
$accessToken = $instagram->getAccessToken();
$_SESSION['InstagramAccessToken'] = $accessToken;
$instagram->setAccessToken($_SESSION['InstagramAccessToken']);
$popular = $instagram->getPopularMedia();
// After getting the response, let's iterate the payload
var_dump($popular);
added just now:
$conn = new MongoClient('mongodb://localhost/?w=1');
$db = $conn->instagram;
// access collection
$collection = $db->instagram1;
$collection->insert($popular);
How would I construct a PDO query to 'autobuild' the table structure just like the JSON object at reply from my request?
Repaste of object. Most got cut off due to size
Update: I tried to insert straight into a collection, I get no error but the DB is still the same size
show dbs Data 0.078GB admin (empty) instagram 0.078GB local 0.078GB test 0.078GB week1 (empty)