Skip to content

Instantly share code, notes, and snippets.

@cwicaksono
cwicaksono / sparkpost.php
Created April 1, 2019 11:48
Snippet to send email using sparkpost API
<?php
$title = "Title goes here"'
$email_title = "Email subject goes here";
$email_recipent = "email@domain.com";
$message = "Put your html email body in <strong>here</strong>";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.sparkpost.com/api/v1/transmissions');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title>Blog Home - Solusi Programming</title>
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Welcome extends CI_Controller {
function __construct() {
parent::__construct();
$this->load->model('blogpost_model');
$this->load->model('categories_model');
}
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/*
Copyright (c) 2011 Lonnie Ezell
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Blogpost_model extends MY_Model {
protected $table = 'blogpost';
protected $key = 'id';
protected $soft_deletes = false;
protected $date_format = 'datetime';
protected $set_created = false;
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Categories_model extends MY_Model {
protected $table = 'categories';
protected $key = 'id';
protected $soft_deletes = false;
protected $date_format = 'datetime';
protected $set_created = false;
-- phpMyAdmin SQL Dump
-- version 4.8.3
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Jan 15, 2020 at 01:34 PM
-- Server version: 5.7.23
-- PHP Version: 7.1.22
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Welcome extends CI_Controller {
function __construct() {
parent::__construct();
$this->load->model('blogpost_model');
$this->load->model('categories_model');
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title>Blog Home - Solusi Programming</title>
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateTabelProduk extends Migration
{
/**
* Run the migrations.