laposta / laposta-api-php Goto Github PK
View Code? Open in Web Editor NEWEasy php-wrapper for Laposta api
License: MIT License
Easy php-wrapper for Laposta api
License: MIT License
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.
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;
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.