Working Ninja
2017-04-03T20:16:40
from sqlalchemy.sql import text
from sqlalchemy import create_engine

import secrets


engine = create_engine(
    'mssql+pyodbc://{}:{}@MSSQL'.format(
        secrets.username, secrets.password
    )
)
conn = engine.connect()

s = text("SELECT * FROM users WHERE name = :name")
result = conn.execute(s, name=name).fetchall()
print result

For further information on installing and configuring unixODBC (requirement for pyodbc) on Linux: …

READ MORE

2017-03-31T22:33:13
function sendWebhook($data) {
    $url = 'https://url/';
    $jsonDataEncoded = json_encode($data);
    $webhook = curl_init($url);
    curl_setopt($webhook, CURLOPT_POST, 1);
    curl_setopt($webhook, CURLOPT_POSTFIELDS, $jsonDataEncoded);
    curl_setopt($webhook, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
    $result = curl_exec($webhook);
}

$data = array(
    'key' => 'value'
);

sendWebhook($data);

Source: http://thisinterestsme.com/sending-json-via-post-php/

READ MORE