This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$url = 'http://www.website.com/file.json'; | |
$curl = curl_init($url); | |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true); | |
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); | |
curl_setopt($curl, CURLOPT_POSTFIELDS, '{}'); | |
$response = curl_exec($curl); | |
$resultStatus = curl_getinfo($curl); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function _getPlayerFromElastic($field, $keywords) { | |
$returnItem = array(); | |
$keywordImplode = implode(" OR ", $keywords); | |
$query = '{"query":{"bool":{"must":[{"query_string":{"default_field":"' . $field . '","query":"' . $keywordImplode . '"}}],"must_not":[],"should":[]}},"from":0,"size":10,"sort":[],"facets":{}}'; | |
$url = 'http://162.222.178.137:9200/message/_search'; | |
$curl = curl_init($url); | |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($curl, CURLOPT_POSTFIELDS, $query); | |
$response = curl_exec($curl); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function insert_to_es($collection, $type, $id, $data, $ip = "localhost") | |
{ | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, 'http://' . $ip . ':9200/' . $collection . '/' . $type . '/' . $id); | |
curl_setopt($ch, CURLOPT_HEADER, 0); | |
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 20); | |
curl_setopt($ch, CURLOPT_TIMEOUT, 60); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($ch, CURLOPT_POST, 1); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function insert_to_es($collection, $type, $id, $data, $ip = "localhost") | |
{ | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, 'http://' . $ip . ':9200/' . $collection . '/' . $type . '/' . $id); | |
curl_setopt($ch, CURLOPT_HEADER, 0); | |
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 20); | |
curl_setopt($ch, CURLOPT_TIMEOUT, 60); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($ch, CURLOPT_POST, 1); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link rel="import" href="../topeka-elements/category-images.html"> | |
<link rel="import" href="../core-icon/core-icon.html"> | |
<link rel="import" href="../core-icons/core-icons.html"> | |
<link rel="import" href="../core-icons/av-icons.html"> | |
<link rel="import" href="../paper-fab/paper-fab.html"> | |
<polymer-element name="my-element"> | |
<template> | |
<style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
if ('serviceWorker' in navigator) { | |
navigator.serviceWorker.register('sw.js'); | |
} | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Document</title> | |
</head> | |
<body> | |
<script type="text/javascript"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
importScripts('node_modules/sw-toolbox/sw-toolbox.js'); | |
self.addEventListener('install', (event) => { | |
self.skipWaiting(); | |
}); | |
self.addEventListener('activate', (event) => { | |
event.waitUntil(self.clients.claim()); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function onBuyClicked() { | |
var supportedInstruments = [{ | |
supportedMethods: ['amex', 'diners', 'discover', 'jcb', 'mastercard', | |
'unionpay', 'visa'] | |
}]; | |
var details = { | |
total: {label: 'Donation', amount: {currency: 'USD', value: '55.00'}}, | |
displayItems: [ | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function onBuy() { | |
// Define supported credit card | |
var supportedInstruments = [{ | |
supportedMethods: ['amex', 'diners', 'discover', 'jcb', 'mastercard', | |
'unionpay', 'visa'] | |
}]; | |
//Order detail | |
var details = { | |
total: {label: 'Product', amount: {currency: 'THB', value: '10.00'}}, | |
displayItems: [ |
OlderNewer