Giter VIP home page Giter VIP logo

exportcomments-php's Introduction

exportcomments-php

Official PHP client for the ExportComments API. Export Social Media Comments from your PHP apps.

Autoload

The first step to use exportcomments-php is to download composer:

$ curl -s http://getcomposer.org/installer | php

Then we have to install our dependencies using:

$ php composer.phar install

Now we can use autoloader from Composer by:

{
  "require": {
    "exportcomments/exportcomments-php": "~0.1"
  }
}

Or, if you don't want to use composer, clone the code and include this line of code:

require 'autoload.php';

Usage examples

Here are some examples of how to use the library in order to create and use exports:

require 'autoload.php';

// Use the API key from your account
$export = new ExportComments\Client('<YOUR API KEY HERE>');

Create export

// Create a new export
$data = array('url' => 'https://www.facebook.com/post/123456789', 'replies' => false, 'twitterType' => null);
$res = $export->exports->createExport($data);
var_dump($res);

Response

{
  "code": 200,
  "success": true,
  "data": {
    "url": "https://www.instagram.com/p/1234567",
    "guid": "2cfb0b9d-7633-4341-a702-cb889fe549eb",
    "status": "done",
    "replies": false,
    "fileName": "comments5ea4b4d5a7602-1325511884314646.xlsx",
    "fileNameRAW": "08b735760a5a40eb1fd70ca16e97aed3-2e0916fe-de86-4422-8449-fb608cbe5221.json",
    "total": 100,
    "totalExported": 98,
    "retry": 0,
    "error": null,
    "repliesCount": 0,
    "twitterType": null,
    "timezone": "UTC",
    "createdAt": "2016-08-26T07:32:27+00:00",
    "updatedAt": "2016-08-26T07:32:27+00:00",
    "exportedAt": "",
    "downloadUrl": "/exports/comments5ea4b4d5a7602-1325511884314646.xlsx",
    "rawUrl": "/exports/08b735760a5a40eb1fd70ca16e97aed3-2e0916fe-de86-4422-8449-fb608cbe5221.json"
  },
  "message": null
}

Checking export status

// Check export by uniqueId
$uniqueId = 'dfd6a2f2-5579-421f-96ac-98993d0edea1';
$res = $export->exports->checkExport($uniqueId);
var_dump($res);

Response

{
  "code": 200,
  "success": true,
  "data": {
    "url": "https://www.instagram.com/p/1234567",
    "guid": "dfd6a2f2-5579-421f-96ac-98993d0edea1",
    "status": "queueing",
    "replies": false,
    "fileName": "comments5ea4b4d5a7602-1325511884314646.xlsx",
    "fileNameRAW": "08b735760a5a40eb1fd70ca16e97aed3-2e0916fe-de86-4422-8449-fb608cbe5221.json",
    "total": 0,
    "totalExported": 0,
    "retry": 0,
    "error": null,
    "repliesCount": 0,
    "twitterType": null,
    "timezone": "UTC",
    "createdAt": "2016-08-26T07:32:27+00:00",
    "updatedAt": "2016-08-26T07:32:27+00:00",
    "exportedAt": "",
    "downloadUrl": "/exports/comments5ea4b4d5a7602-1325511884314646.xlsx",
    "rawUrl": "/exports/08b735760a5a40eb1fd70ca16e97aed3-2e0916fe-de86-4422-8449-fb608cbe5221.json"
  },
  "message": null
}

Exports list

$res = $export->exports->listExports();
var_dump($res);

Response

[
  {
    "url": String,
    "createdAt": Date,
    "guid": Uuid,
    "status": String,
    "exportedAt": Date,
    "error": String,
    "total": Int,
    "totalExported": Int,
    "replies": Bool,
    "repliesCount": Int,
    "downloadUrl": String,
    "rawUrl": String
  },
  {
    "url": String,
    "createdAt": Date,
    "guid": Uuid,
    "status": String,
    "exportedAt": Date,
    "error": String,
    "total": Int,
    "totalExported": Int,
    "replies": Bool,
    "repliesCount": Int,
    "downloadUrl": String,
    "rawUrl": String
  }
]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.