示例#1
0
<?php

session_start();
require_once "OAuth.php";
require_once "config.php";
$offset = readGetParam('page', 0) - 1;
$meetup_url = 'https://api.meetup.com/2/members?group_id=' . $_REQUEST['group_id'] . '&page=' . readGetParam('limit', 20) . "&offset=" . $offset;
$signature = new OAuthSignatureMethod_HMAC_SHA1();
$consumer = new OAuthConsumer($key, $secret, NULL);
$token = new OAuthConsumer($oauth_token_per, $oauth_token_secret_per, 1);
$request = OAuthRequest::from_consumer_and_token($consumer, $token, "GET", $meetup_url);
$request->sign_request($signature, $consumer, $token);
$header = $request->to_header("https://api.meetup.com");
error_log('2_members_URL:' . $meetup_url);
$meetup_response = _http_request($meetup_url, $header);
jsonEcho($meetup_response);
示例#2
0
文件: qnet2_par.php 项目: sbst/code
//exec("ping -w 1 -i 0.2 -c 1 ".$_GET['jsonData'], $out, $status);
$config = ssh2Auth($_POST['jsonData']);
if ($config === false) {
    break;
}
$object = parsData($config, $_POST['jsonData']);
for ($ix = 0; $ix < count($object); ++$ix) {
    if ($object[$ix]["int"] == "lo" || $object[$ix]["addr"] == "127.0.0.1") {
        unset($object[$ix]);
        $object = array_values($object);
    } elseif ($object[$ix]["addr"] == "unassigned") {
        unset($object[$ix]);
        $object = array_values($object);
    }
}
jsonEcho($object);
function ssh2Auth($sendData)
{
    if (!($connection = ssh2_connect($sendData, "22"))) {
        return false;
    }
    if (!ssh2_auth_password($connection, "administrator", "Spb78sts!")) {
        return false;
    }
    if (!($stream = ssh2_exec($connection, 'ifconfig'))) {
        return false;
    } else {
        stream_set_blocking($stream, true);
        $stream_out = ssh2_fetch_stream($stream, SSH2_STREAM_STDIO);
        $config = stream_get_contents($stream_out);
    }
示例#3
0
<?php

session_start();
require_once "OAuth.php";
require_once "config.php";
if ($_COOKIE['member_id'] && $_COOKIE['oauth_token'] && $_COOKIE['oauth_token_secret']) {
    jsonEcho(json_encode(array('results' => array('id' => $_COOKIE['member_id']))));
} else {
    jsonEcho(json_encode(array('results' => array('id' => -1))));
}
示例#4
0
<?php

session_start();
require_once "OAuth.php";
require_once "config.php";
if (!empty($_REQUEST) && is_array($_REQUEST)) {
    $fields_string_arr = array();
    foreach ($_REQUEST as $key => $value) {
        if (preg_match('/^answer\\_/', $key)) {
            $fields_string_arr[$key] = $value;
        }
    }
    $fields_string_arr['group_id'] = $_REQUEST['group_id'];
    $fields_string_arr['group_urlname'] = $_REQUEST['group_urlname'];
    $fields_string_arr['intro'] = 'hello';
    //Join Group URL
    $url_join_group = 'https://api.meetup.com/2/profile';
    $signature = new OAuthSignatureMethod_HMAC_SHA1();
    $consumer = new OAuthConsumer($key, $secret, NULL);
    $token = new OAuthConsumer($oauth_token_per, $oauth_token_secret_per, 1);
    $request = OAuthRequest::from_consumer_and_token($consumer, $token, "POST", $url_join_group);
    $request->sign_request($signature, $consumer, $token);
    $header = $request->to_header();
    error_log('2_rsvps_URL:' . $meetup_url . ' , group_id:' . $fields_string_arr['group_id'] . " , member_id:" . $member_id);
    $response_join = _http_request($url_join_group, $header, $fields_string_arr, 'POST');
    jsonEcho($response_join);
}