Skip to content

Instantly share code, notes, and snippets.

View hatimn02's full-sized avatar

Hatim Nagdawala hatimn02

  • Walkover web solutions pvt. ltd.
  • Indore
View GitHub Profile
@hatimn02
hatimn02 / socket.sh
Last active July 27, 2016 11:10
cURL sample code
curl "http://viasocket.com/t/YFRHZEw2JxDXEsdF"\
-X POST\
-H "authkey: YOUR_AUTH_KEY"\
-H "Content-Type: application/json"\
-d '{"param_name":"param_value","param_name2":"param_value 2"}'
@hatimn02
hatimn02 / socket.java
Created July 26, 2016 07:56
Java sample code
import org.json.simple.JSONObject;
import java.io.*;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
public class Socket {
public static void invoke() {
//Your authentication key
@hatimn02
hatimn02 / socket.rb
Created July 26, 2016 07:55
Ruby sample code
require "net/http"
require "uri"
require 'json'
base_uri = "http://flow.viasocket.com/trigger/team/flow_identifier" #Set your Socket Api
base_uri = base_uri + "?param1=value1&param2=value2" #Set query params
uri = URI.parse(base_uri)
data = {
status: "testing",
@hatimn02
hatimn02 / socket.py
Created July 26, 2016 07:55
Python sample code
from urllib import urlencode
from urllib2 import Request, urlopen
authkey = 'YOUR_AUTHKEY' # Set your Auth-Key here
url = 'http://flow.viasocket.com/trigger/sample_url/slack_integration' # Set your socket URL here
post_fields = {'foo': 'bar'} # Set POST fields here
request = Request(url, urlencode(post_fields).encode())
request.add_header('Auth-Key', authkey)
@hatimn02
hatimn02 / socket.php
Last active August 3, 2016 06:00
PHP sample code
<?php
// The data to send to the Flow
$data_string = array(
'contact_no' => '999999999',
'caller_phone' => '888888888',
'company' => 'socket',
'branch_info' => 'India',
);
$postData = json_encode($data_string);
$URL = 'FLOW_URL_WITH_AUTH_KEY'; //https://viasocket.com/t/y8K5iJYnC69VM5wMPKJ/my-testing?authkey=zqkUoQdhskfdsfdsf
@hatimn02
hatimn02 / socket.js
Created July 26, 2016 07:54
NodeJS sample code
//Load the request module
var request = require('request');
//Lets configure and request
request({
url: 'http://flow.viasocket.com/trigger/sample_url/slack_integration', //Replace with your socket api
qs: {from: 'socket sample', time: +new Date()}, //Query string data
method: 'POST',
headers: {
'Content-Type': 'application/json',
@hatimn02
hatimn02 / socket.html
Created July 26, 2016 07:52
HTML with jQuery sample code
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$.post("http://flow.viasocket.com/trigger/sample_url/slack_integration"+"?Auth-Key="+"YOUR_AUTHKEY",
{
name: "Donald Duck",
@hatimn02
hatimn02 / Java Script
Last active May 25, 2016 07:55
Via Socket Sample Codes
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$.post("http://flow.viasocket.com/trigger/sample_url/slack_integration"+"?Auth-Key="+"YOUR_AUTHKEY",
{
name: "Donald Duck",