Monthly Archives: March 2016

Export php array to CSV – Download CSV File

Export php array to CSV
CSV (comma-separated values) is the most widely supported format for transferring tabular data. Exporting data in CSV format is very common in web applications. This simple example will help you get started with CSV and PHP. The main goal is to create a simple way to export data from your website or web application into a CSV that can be downloaded by the user.


    $data = array(
        array('name' => 'A', 'mail' => 'a@gmail.com', 'age' => 43),
        array('name' => 'C', 'mail' => 'c@gmail.com', 'age' => 24),
        array('name' => 'B', 'mail' => 'b@gmail.com', 'age' => 35),
        array('name' => 'G', 'mail' => 'f@gmail.com', 'age' => 22),
        array('name' => 'F', 'mail' => 'd@gmail.com', 'age' => 52),
        array('name' => 'D', 'mail' => 'g@gmail.com', 'age' => 32),
        array('name' => 'E', 'mail' => 'e@gmail.com', 'age' => 34),
        array('name' => 'K', 'mail' => 'j@gmail.com', 'age' => 18),
        array('name' => 'L', 'mail' => 'h@gmail.com', 'age' => 25),
        array('name' => 'H', 'mail' => 'i@gmail.com', 'age' => 28),
        array('name' => 'J', 'mail' => 'j@gmail.com', 'age' => 53),
        array('name' => 'I', 'mail' => 'l@gmail.com', 'age' => 26),
    );

$fileName_1 = 'Manifest.csv';
        header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
        header('Content-Description: File Transfer');
        header("Content-type: text/csv");
        header("Content-Disposition: attachment; filename={$fileName_1}");
        header("Expires: 0");
        header("Pragma: public");
        $fh1 = @fopen( 'php://output', 'w' );
        $headerDisplayed1 = false;

        foreach ( $data as $data1 ) {
            // Add a header row if it hasn't been added yet
            if ( !$headerDisplayed1 ) {
                // Use the keys from $data as the titles
                fputcsv($fh1, array_keys($data1));
                $headerDisplayed1 = true;
            }

            // Put the data into the stream
            fputcsv($fh1, $data1);
        }
    // Close the file
        fclose($fh1);
    // Make sure nothing else is sent, our file is done
        exit;

Share

Build Alexa-enabled Apps

This is reference of my collection from different sources.

Image From Wikipedia

Skill to learn – 

Custom Slot Types
Writing Alexa Skills with Node.js
Deployment
Integrating Testing an Alexa Skill
Alexa Cards Interaction: displaying data on cards
Voice User Interface Design
Speech Synthesis Markup Language
Internet of Things Interaction
Account Linking
Skill Submission
Providing Updates
No preference

API to use for testing or for real  –  http://services.faa.gov/docs/services/

Useful links –

Developers Resources For ASK & AVS Developers

Training / Tutorials

Amazon Echo Dev Portal

Amazon Alexa Dev Portal

Amazon Web Services Events & Webinars Portal – subscribe via RSS to be notified of new events in your area(s) of interest

Udemy – Introduction to Voice Design with Amazon’s Alexa

Big Nerd Ranch – Alexa Skills Kit – course(s) not yet released, but you can sign up to be notified when available on the linked page

w3schools JSON Tutorial

Anythings Alexa Skills Kit Tutorial

ToBuildSomething’s Amazon Alexa Skills Kit SDK: The Ultimate Guide

Ruuvu: Building An Alexa Skill For IMDB Ratings With Alexa-app

 

ASK / Alexa Dev Communities

Amazon Developer Forum – Alexa Skills Kit

Amazon Developer Forum – Alexa Voice Service

Stack Overflow – Latest Alexa Skills Kit Questions

Stack Overflow – Latest Alexa Skills Questions

Stack Overflow: Latest Alexa Voice Service Questions

Seattle Area Meetup for Alexa Devs

NYC Area Meetup for Alexa Devs

Los Angeles Area Meetup for Alexa Devs

Boston Area Meetup for Alexa Devs

Columbus Area Meetup for Alexa Devs

 

Sample Code / Developer Toolkits

Matt Kruse’s Alexa App Node Module

Nicholas Clawson’s Alexa-bility Skills Framework For Node:
Interactive Demo
Documentation
Examples
Toolkit

Amazon’s Github Repository for Alexa Skills Kit Dev in Java

Amazon’s Github Repository for Alexa Skills Kit Dev in Javascript

Anjishnu’s Github Repository: Python ASK Developer Toolkit

Rocktavious’s Github Repository: Django ASK Developer Toolkit

stefann42’s Github Repository: .NET ASK Developer Toolkit

develpr’s Github Repository: Laravel & Lumen Classes to Make ASK Development Easier

 

Miscellaneous

Amazon’s Alexa Device Source Code Repository

MSDN Speech Synthesis Markup Language (SSML) Reference Library

JSON.org JSON Reference Library

Nodejs.org Node Reference Library

ASK Developer Wiki on Reddit

My own developer guide to Using Session Attributes in Javascript – free pdf, can be printed or downloaded

How To Check Amazon Server Status, Streaming Service Status

Amazon Alexa/Echo Team Twitter Account

Amazon Alexa Tech Business Developer Marion Desmazieres Twitter Account

Share