chrisreedio/jotform-api-php 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

chrisreedio/jotform-api-php

最新稳定版本:v1.0.0

Composer 安装命令:

composer require chrisreedio/jotform-api-php

包简介

README 文档

README

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.

统计信息

  • 总下载量: 53
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 41
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0
  • 更新时间: 2024-02-14