PHP code example of wallstreetio / ontraport
1. Go to this page and download the library: Download wallstreetio/ontraport library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
wallstreetio / ontraport example snippets
$products = $ontraport->products
->where('name', 'ONTRAPages')
->orWhere('name', 'ONTRAForms')
->get();
$ontraport = new \Wsio\Ontraport\Ontraport('APP_ID', 'APP_KEY');
$contacts = $ontraport->contacts->get();
$contacts = $ontraport->contacts
->where('firstname', 'Bob')
->orderBy('id')
->get();
$contacts = $ontraport->contacts
->range(25)
->start(50)
->get();
$contact = $ontraport->contacts->find(1);
$contact = $ontraport->contacts->where('email', '[email protected] ')->first();
echo $contact->email; // [email protected]
$contact = $ontraport->contacts->create([
'email' => '[email protected] '
]);
$contact = $ontraport->contacts->saveOrUpdate([
'firstname' => 'Tamer',
'email' => '[email protected] '
]);
$ontraport->contacts->update(1, [
'email' => '[email protected] '
]);
$contact = $ontraport->contacts->find(1);
$contact->lastname = 'Rules';
$contact->save();
$ontraport->contacts->delete(1);
$contact = $ontraport->contacts->find(1);
$contact->delete();
$ontraport->contacts->delete() // uh-oh :)
$ontraport->contacts->where('email', '[email protected] ')->delete();
$ontraport->contacts->where('lastname', null)->get();
// OR
$ontraport->contacts->whereNull('lastname')->get();
$ontraport->products->whereIn('name', ['ONTRAPages', 'ONTRAForms'])->get();
$ontraport->contacts->orderBy('id', 'desc')->get();
$ontraport->contacts->orderByDesc('id')->get();
$ontraport->contacts
->whereNull('firstame')
->where('email', '[email protected] ')
->orderByDesc('id')
->get();
$sequences = $ontraport->sequences->get();
$purchase = $ontraport->purchases->find(1);
class Task extends \Wsio\Ontraport\Resources\Resource
{
protected $namespace = 'Task';
public function assign(array $data = [])
{
return $this->ontraport->post('task/assign', $data);
}
}
$ontraport->extend('tasks', Task::class);
$ontraport->tasks->assign([
'message_id' => 1,
'due_date' => 'now'
]);
$task = $ontraport->post('task/assign', [
'message_id' => 1,
'due_date' => 'now'
]);