Git Product home page Git Product logo

laposta-api-php's People

Contributors

fwiep avatar roelleor avatar stijnvanderree avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

laposta-api-php's Issues

a number of Undefined index messages

I started using the laposta php interface and I get a number of php undefined index messages when I collect the lists.
My code is:
$list = new Laposta_List();
$result = $list->all();

Notice: Undefined index: path in D:\web\kwbadmin\laposta\lib\Laposta\Resource.php on line 16
Notice: Undefined index: parameters in D:\web\kwbadmin\laposta\lib\Laposta\Resource.php on line 17
Notice: Undefined index: post in D:\web\kwbadmin\laposta\lib\Laposta\Resource.php on line 18
Notice: Undefined index: method in D:\web\kwbadmin\laposta\lib\Laposta\Resource.php on line 19
Notice: Undefined index: timeout in D:\web\kwbadmin\laposta\lib\Laposta\Util.php on line 11
Notice: Undefined variable: error_msg in D:\web\kwbadmin\laposta\lib\Laposta\Util.php on line 53

I changed the lines in resource.php from:
$path = is_array($data['path']) ? $data['path'] : array();
$parameters = is_array($data['parameters']) ? $data['parameters'] : array();
$post = is_array($data['post']) ? $data['post'] : array();
$method = $data['method'];
to
$path = isset($data['path']) ? (is_array($data['path']) ? $data['path'] : array()) : array();
$parameters = isset($data['parameters']) ? (is_array($data['parameters']) ? $data['parameters'] : array()) : array();
$post = isset($data['post']) ? (is_array($data['post']) ? $data['post'] : array()) : array();
$method = isset($data['method']) ? $data['method'] : NULL;

and Util.php:11 to
$timeout = isset($options['timeout']) ? (is_numeric($options['timeout']) ? $options['timeout'] : 15) : 15;
and Util.php:53 to
return array('error' => $error, 'error_msg' => isset($error_msg) ? $error_msg : '', 'status' => $info['http_code'], 'body' => $body, 'info' => $info);

I hope this helps to improve the code.

Easy way to detect if a email exists in any list?

Is there a (quick) way to detect if a email exists in any list?
For now I use this litte snippet, but it feels wrong to fetch all subscribers just to check if someone is allready a subscriber:

$memberExistsInList = false;
$member = new \Laposta_Member(\Settings\Laposta::LIST_ID);
$result = $member->all();
foreach ($result['data'] as $key => $member) {
    if ($member['member']['email'] === $email) {
        $memberExistsInList = true;
    }
}

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.