Code Monkey home page Code Monkey logo

Comments (10)

sleiman avatar sleiman commented on September 16, 2024

Hi, can you post a picture of your table names? Airtable is very sensitive to table and column names.

from airtable-php.

cesantibanez avatar cesantibanez commented on September 16, 2024

image

those are the 2 tables that I'm trying to use

from airtable-php.

sleiman avatar sleiman commented on September 16, 2024

@cesantibanez were you able to fix the issue? The table names are fine. It looks like the client is not loading. If you can't make it work, I'm available today to help you. Let me know.

from airtable-php.

cy-josh avatar cy-josh commented on September 16, 2024

I am having this issue as well.

This returns NULL:

$airtable = new Airtable(array(
            'api_key' => 'keyasdf',
            'base'    => 'appasdf'
        ));
        $request = $airtable->getContent( 'Open' );

        do {
            $response = $request->getResponse();
            var_dump( $response[ 'records' ] );
        }
        while( $request = $response->next() );
        
        print_r($request);

from airtable-php.

cy-josh avatar cy-josh commented on September 16, 2024

This ended up being an issue with my local dev environment curl settings. I suspect this is the same issue @cesantibanez is having.

This fixed it for me: https://stackoverflow.com/a/31830614

from airtable-php.

glaliberte avatar glaliberte commented on September 16, 2024

Thanks for sharing what fixed it for you @cy-josh !

@cesantibanez , were you able to fix it?

from airtable-php.

dangelion avatar dangelion commented on September 16, 2024

I'm getting the same: NULL
What's wrong?

<?php
// if not using composer, uncomment this
include('airtable-php-2.2.9/src/Airtable.php');
include('airtable-php-2.2.9/src/Request.php');
include('airtable-php-2.2.9/src/Response.php');

use TANIOS\Airtable\Airtable;

$airtable = new Airtable(array(
    'api_key'   => 'pat3xxxxxxxxxxxxxx',
    'base'      => 'appHpxxxxxxxxxxxxxx',
));

$request = $airtable->getContent('Corporate CMS');

do {

    $response = $request->getResponse();

    var_dump($response['records']);
} while ($request = $response->next());

?>

I'm running my project with the PHP Built-in server: php -S project.test:4000

I tried what @cy-josh linked above but didn't work. Please share exactly how you solved.
Thanks

from airtable-php.

leepettijohn avatar leepettijohn commented on September 16, 2024

@dangelion - 👋
Airtable deprecated the API keys for authentication. They moved to a personal token system
https://airtable.com/developers/web/guides/personal-access-tokens

This is how I've been accessing results ...

$ch = curl_init([url]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Content-Type: application/json',
	'Authorization: Bearer '.[access_token]
));
$result = curl_exec($ch);

If you need help designing a URL to submit this is a good resource - https://codepen.io/airtable/full/MeXqOg

from airtable-php.

dangelion avatar dangelion commented on September 16, 2024

Hi @leepettijohn thanks for answer! I never did it like that. So in you way you're not using the library of this Github?
Could you post a real world code example? There's Airtable documentation about that way?

from airtable-php.

leepettijohn avatar leepettijohn commented on September 16, 2024

Let me know if this helps.

<?php
/*
// to see an example of how a URL should look when all the parameters are used - Airtable API encoder - https://codepen.io/airtable/full/MeXqOg

// REQUIRED
// Find Access Tokens here - https://airtable.com/create/tokens
// Find base here - https://airtable.com/api
$acctoken = '___';
$baseid = '___';	

// I believe I used this template - https://www.airtable.com/universe/expn38xdYZDKzzTqX/the-best-furniture-planner
		
$tablename = 'Furniture';
$tableview = 'All furniture';

//Get results from AT
$url = 'https://api.airtable.com/v0/'.$baseid.'/'.$tablename.'?view='.$tableview;

$ch = curl_init(encodeUrl($url));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Content-Type: application/json',
	'Authorization: Bearer '.$acctoken
));

$result = curl_exec($ch);
print_r($result);

?>

from airtable-php.

Related Issues (20)

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.