GithubHelp home page GithubHelp logo

isabella232 / jotform-api-php Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jotform/jotform-api-php

0.0 0.0 0.0 65 KB

JotForm API - PHP Client

License: GNU General Public License v2.0

PHP 100.00%

jotform-api-php's Introduction

jotform-api-php

JotForm API - PHP Client

Installation

Install via git clone:

    $ git clone git://github.com/jotform/jotform-api-php.git
    $ cd jotform-api-php

or

Install via Composer package manager (https://getcomposer.org/)

composer.json

    {
        "require": {
            "jotform/jotform-api-php": "dev-master"
        }
    }
    $ php composer.phar install

Documentation

You can find the docs for the API of this client at https://api.jotform.com/docs/

Authentication

JotForm API requires API key for all user related calls. You can create your API Keys at API section of My Account page.

Examples

Print all forms of the user

<?php
    
    include "jotform-api-php/JotForm.php";
    
    $jotformAPI = new JotForm("YOUR API KEY");
    $forms = $jotformAPI->getForms();
    
    foreach ($forms as $form) {
        print $form["title"];
    }

?>

Get submissions of the latest form

<?php
    
    try {
        include "jotform-api-php/JotForm.php";
        
        $jotformAPI = new JotForm("YOUR API KEY");

        $forms = $jotformAPI->getForms(0, 1, null, null);

        $latestForm = $forms[0];

        $latestFormID = $latestForm["id"];

        $submissions = $jotformAPI->getFormSubmissions($latestFormID);

        var_dump($submissions);

    }
    catch (Exception $e) {
        var_dump($e->getMessage());
    }
    
?>

Get latest 100 submissions ordered by creation date

<?php
    
    try {
        include "jotform-api-php/JotForm.php";
        
        $jotformAPI = new JotForm("YOUR API KEY");

        $submissions = $jotformAPI->getSubmissions(0, 100, null, "created_at");

        var_dump($submissions);
    }
    catch (Exception $e) {
        var_dump($e->getMessage());
    }
    
?>

Submission and form filter examples

<?php

    try {
        include "jotform-api-php/JotForm.php";
        
        $jotformAPI = new JotForm("YOUR API KEY");
        
        $filter = array(
                "id:gt" => "239252191641336722",
                "created_at:gt" => "2013-07-09 07:48:34",
        );
        
        $subs = $jotformAPI->getSubmissions(0, 0, $filter, "");
        var_dump($subs); 
        
        $filter = array(
                "id:gt" => "239176717911737253",
        );
        
        $formSubs = $jotformAPI->getForms(0, 0, 2, $filter);
        var_dump($formSubs);
    } catch (Exception $e) {
            var_dump($e->getMessage());
    }
    
?>

Delete last 50 submissions

<?php
    
    try {
        include "jotform-api-php/JotForm.php";
        
        $jotformAPI = new JotForm("YOUR API KEY");

        $submissions = $jotformAPI->getSubmissions(0, 50, null, null);

        foreach ($submissions as $submission) {
            $result = $jotformAPI->deleteSubmission($submission["id"]);
            print $result;
        }
    }
    catch (Exception $e) {
        var_dump($e->getMessage());
    }
    
?>

First the JotForm class is included from the jotform-api-php/JotForm.php file. This class provides access to JotForm's API. You have to create an API client instance with your API key. In case of an exception (wrong authentication etc.), you can catch it or let it fail with a fatal error.

jotform-api-php's People

Contributors

alpdeni avatar appaky avatar aytekintank avatar cbalci avatar eeertekin avatar elifceren avatar felipevolpatto avatar kennethpdev avatar meunal avatar neilvicente avatar nicholas-westley avatar shumagorath86 avatar thedigitalorchard avatar umutbugrahan avatar

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.