function callback_subscribers($cinemas) { $cinemas_updated = base64_encode(json_encode($cinemas)); $db = DatabaseFactory::get_provider(); $subscribers = $db->get_subscribers(); foreach ($subscribers as $subscriber) { $url = $subscriber->value->callback; post_request($url, $cinemas_updated); } }
static function run() { //获得配置 self::$config = config('app'); //设置时区 date_default_timezone_set(self::$config['TIMEZONE']); //开启session self::$config['SESSION_AUTO_START'] && session_start(); //定义请求方式 define('IS_AJAX', ajax_request()); define('IS_POST', post_request()); //错误提示 self::openWhoops(); //载入ORM self::loadOrm(); //运行路由 Router::init(); }
$object_array['FldName'] = $field; $object_array['Srt'] = strtoupper($sort_type); } if ($alpha_type != "") { $object_array['chr'] = strtolower($alpha_type); } global $user_ID; if ($user_ID) { $object_array['userId'] = $user_ID; } if ($object_id != "") { $object_array['RecordId'] = $object_id; $object_array['RelatedToapi'] = $parent_obj_type; } //echo json_encode($object_array); $json_response = post_request($url, $access_token, json_encode($object_array), "POST"); //var_dump($json_response); $response_array = explode("chunked", $json_response); if (isset($response_array[1])) { $json_response = $response_array[1]; } //} $result = json_decode($json_response); if (isset($result[0]->errorCode)) { //var_dump($response); $admin_email = get_option("admin_email"); mail($admin_email, $response[0]->errorCode, $response[0]->message); echo json_encode(array("errorCode" => "Request Message", "message" => "Something event wrong. Please contact your system Administrator.")); exit; } $response = json_decode($result);
* the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * enviroCar is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with enviroCar. If not, see <http://www.gnu.org/licenses/>. */ require 'connection.php'; //Registration if (isset($_GET['registration'])) { $newUser = array("name" => '' . $_POST['name'], "mail" => '' . $_POST['email'], "token" => '' . $_POST['password1']); $response = post_request(get_serverurl() . '/users', $newUser, false); if ($response["status"] == 201) { $_SESSION['name'] = $_POST['name']; $_SESSION['password'] = $_POST['password']; header('Location: ../../index.php?registration_successful'); } elseif ($response["status"] == 409) { header('Location: ../../registration.php?name_taken'); } else { echo $response['status']; } } else { if (isset($_GET['logout'])) { if (isset($_SESSION)) { session_destroy(); } header('Location: ../../index.php?lo=done');
<?php $url = "merge.php"; $url1 = $_POST[url1]; $url2 = $_POST[url2]; $data = array('url1' => $url1, 'url2' => $url2); $result = post_request($url, $data, $referer = 'kleiderkuh.de'); //echo $result['status']; echo $result['content']; function post_request($url, $data, $referer = '') { // Convert the data array into URL Parameters like a=b&foo=bar etc. $data = http_build_query($data); // parse the given URL $url = parse_url($url); if ($url['scheme'] != 'http') { die('Error: Only HTTP request are supported !'); } // extract host and path: $host = $url['host']; $path = $url['path']; // open a socket connection on port 80 - timeout: 30 sec $fp = fsockopen($host, 80, $errno, $errstr, 30); if ($fp) { // send the request headers: fputs($fp, "POST {$path} HTTP/1.1\r\n"); fputs($fp, "Host: {$host}\r\n"); if ($referer != '') { fputs($fp, "Referer: {$referer}\r\n"); } fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
echo $response['response']; } else { echo $response['status']; } } if (isset($_GET['groupActivities'])) { $response = get_request($baseURL . '/groups/' . rawurlencode($_GET['groupActivities']) . '/activities', true); if ($response['status'] == 200) { echo $response['response']; } else { echo $response['status']; } } if (isset($_GET['joinGroup'])) { $user = array("name" => '' . $_SESSION['name']); $response = post_request($baseURL . '/groups/' . rawurlencode($_GET['joinGroup']) . '/members', $user, true); if ($response['status'] == 204) { echo $response['response']; } else { echo $response['status']; } } if (isset($_GET['leaveGroup'])) { $response = delete_request($baseURL . '/groups/' . rawurlencode($_GET['leaveGroup']) . '/members/' . $_SESSION['name']); if ($response['status'] == 204) { echo $response['response']; } else { echo $response['status']; } } if (isset($_GET['deleteGroup'])) {
<?php defined("USERGETTER") || define("USERGETTER", true); require_once "../common/get_user.php"; defined("FAKE") || define("FAKE", true); require_once "../common/fake_handler.php"; defined("FUNCTIONSOFUSERS") || define("FUNCTIONSOFUSERS", true); require_once "user_funcs.php"; if (!($user = get_user_from_cookie())) { header("Location: " . NOT_FOUND_URL); exit; } $ticket = null; if ($_SERVER["REQUEST_METHOD"] == "POST") { echo post_request($user); exit; } elseif ($_SERVER["REQUEST_METHOD"] == "GET") { if (!isset($_GET['iti'])) { header("Location:" . NOT_FOUND_URL); exit; } $ticket_fake_id = $_GET["iti"]; $ticket_id = get_id($ticket_fake_id); $ticket = Ticket::get_ticket_by_id($ticket_id); if (is_null($ticket) || $ticket->get_related_user_id() != $user->Id && get_user_level($user->ID) !== 10) { header("Location : " . NOT_FOUND_URL); } } /** * This function call when a post request send .If that request is a valid addTicket request, new ticket will added, * Else redirect user to not found page or echo error message;
#sendMail("*****@*****.**", "Reifstore New", "Mac Validada " . $TBK_ORDEN_COMPRA, "Mac Validada " . $TBK_ORDEN_COMPRA); $result = post_request('http://200.72.16.53/modules/webpay/valida.php', $post_data); $theValue = $result['content']; if ($theValue == "RECHAZADO") { #sendMail("*****@*****.**", "Reifstore CM", "RECHAZADO " . $_POST['TBK_ORDEN_COMPRA'], "Montos no Coinciden " . $_POST['TBK_ORDEN_COMPRA']); echo "RECHAZADO"; } } else { #sendMail("*****@*****.**", "Reifstore CM", "RECHAZADO PARAMETROS VALIDA_MAC(): " . $TBK_ORDEN_COMPRA, "RECHAZADO YA QUE FALTAN PARAMETROS"); $theValue = "RECHAZADO"; } ################################################################################################################# } else { #sendMail("*****@*****.**", "Reifstore", "Entro ELSE Reifstore " . $TBK_ORDEN_COMPRA, "Hago POST a validation.php " . $TBK_ORDEN_COMPRA); if (validar_mac()) { $result = post_request('http://200.72.16.53/tienda/modules/webpay/validation.php', $post_data); $theValue = $result['content']; #sendMail("*****@*****.**", "Reifstore", "Pasando compra " . $_POST['TBK_ORDEN_COMPRA'], "Revisando montos ($theValue = ".$theValue.")" . $_POST['TBK_ORDEN_COMPRA']); if ($theValue == "RECHAZADO") { #sendMail("*****@*****.**", "Reifstore new", "RECHAZADO " . $_POST['TBK_ORDEN_COMPRA'], "Montos no Coinciden " . $_POST['TBK_ORDEN_COMPRA']); echo "RECHAZADO"; } } else { #sendMail("*****@*****.**", "Reifstore", "RECHAZADO PARAMETROS VALIDA_MAC(): " . $TBK_ORDEN_COMPRA, "RECHAZADO validar_mac()"); $theValue = "RECHAZADO"; } } } if ($theValue == "ACEPTADO") { #sendMail("*****@*****.**", "Reifstore new", "Checking MAC " . $_POST['TBK_ORDEN_COMPRA'], "Checking MAC " . $_POST['TBK_ORDEN_COMPRA']); echo "ACEPTADO";
echo $response['response']; } else { echo $response['status']; } } if (isset($_GET['friendActivities'])) { $response = get_request($baseURL . '/users/' . rawurlencode($_SESSION['name']) . '/friendActivities', true); if ($response['status'] == 200) { echo $response['response']; } else { echo $response['status']; } } if (isset($_GET['lostPassword'])) { $changeData = array("user" => array("name" => $_POST['user'], "mail" => $_POST['email'])); $response = post_request($baseURL . '/resetPassword', $changeData, false); if ($response['status'] == 200) { echo json_encode($response); } else { echo json_encode($response); } } if (isset($_GET['resetPassword'])) { $changeData = array("user" => array("name" => $_POST['user'], "token" => $_POST['password']), "code" => $_POST['code']); $response = put_request($baseURL . '/resetPassword', $changeData); if ($response['status'] == 200) { echo json_encode($response); } else { echo json_encode($response); } }
echo 'Updating `department` table ... '; $db->begin(); foreach ($departments as $department) { $code = (string) $department['value']; if ($code) { $name = kana((string) $department); $db->insert('department', array('department_code' => $code, 'name' => $name)); } } $db->commit(); echo PRINT_OK . PHP_EOL; /* 講義データのリストを取得 */ echo 'Updating `list` table ... '; $postdata = array('MODE' => 0, 'STARTNO' => 0, 'NENDO' => $year, 'CODE_JYOUKEN' => 0, 'BtKENSAKU' => 0); for ($i = 0, $j = -1;; $j = -1) { $src = post_request(SEARCH_URL, $postdata); $html = htmlobject($src); $tr = $html->body->form->table[1]->tbody->tr; if (count($tr) <= 1) { echo "[27G[K{$i} " . PRINT_OK . PHP_EOL; break; } $db->begin(); foreach ($tr as $row) { $td = $row->td; if (++$j === 0) { continue; } $q = preg_split('/&|=/', $td[3]->a['href']); $db->insert('list', array('year' => $q[1], 'department_code' => $q[3], 'internal_code' => $q[5], 'place' => $td[7])); }
// //define('COMPILER_PATH', '../cgi-bin/'); define('COMPILER_PATH', 'http://gamewizard.cc/cgi-bin/'); // compile it try { if (isset($_POST["code"])) { // compile the original source code $req = post_request(COMPILER_PATH . 'ccc', array("code", $_POST["code"])); // check for compiling errors $response = substr($req["content"], strpos($req["content"], "\n\n") + 2); if (!preg_match("/^Chinchilla \\d+(\\.\\d+)* OK\n\n/", $req["content"])) { throw new ErrorException($response); } throw new ErrorException($response); // calling the assembler $req = post_request(COMPILER_PATH . 'ccasm', array("code", $response)); // checking for assembly errors $response = substr($req["content"], strpos($req["content"], "\n\n") + 2); if (!preg_match("/^CCASM \\d+(\\.\\d+)* OK\n\n/", $req["content"])) { throw new ErrorException($response); } // success! die(json_encode(array("status" => "ok", "data" => $response))); } else { die('<html><head><title>FFFFFFFFFFFFUUUUUUUUUUUUUUUUUUU</title></head><body><img src="pic.jpg"></body></html>'); } } catch (ErrorException $e) { die(json_encode(array("status" => "error", "data" => $e->getMessage()))); } // post_request() // makes a POST request. $data is a (key,value) array
// Get just accepted items if ($clothes[$j]->accepted == true) { $clothes[$j]->actualAmount = $clothes[$j]->actualAmount + 1; $clothes[$j]->saveClothData(); } } break; case "Waiting for customer": //$transaction->PaymentDate = date("Y-m-d H:i:s"); break; case "Return": $transaction->PaymentDate = date("Y-m-d H:i:s"); break; case "Donate": $transaction->PaymentDate = date("Y-m-d H:i:s"); break; case "Payment": $transaction->PaymentDate = date("Y-m-d H:i:s"); break; case "Finished": $transaction->FinishedDate = date("Y-m-d H:i:s"); break; } // Store to DB $transaction->save(); // Send email post_request("http://" . $_SERVER['HTTP_HOST'] . "/sendStatusMail.php", array("id" => $id)); echo "successfully stored {$id} with new status {$statusName}"; } else { echo "error no POST data"; }
<?php $from = "demo"; //Ваше альфаимя! $to = "380987654321"; //Номер получателя $start = "16:45"; $text = "Тестовое сообщение"; $login = ''; //Логин $password = ''; //Пароль $url = 'http://sms.businesslife.com.ua//clients.php'; //URL для отправки сообщений $xml = "<message><service id='single' validity='+2 hour' source='{$from}' start='{$start}'/><to>{$to}</to><body content-type='text/plain' encoding='plain'>{$text}</body></message>"; $answ = post_request($xml, $url, $login, $password); echo "{$answ}\n"; function post_request($data, $url, $login, $pwd) { $credent = sprintf('Authorization: Basic %s', base64_encode($login . ":" . $pwd)); $params = array('http' => array('method' => 'POST', 'content' => $data, 'header' => $credent)); $ctx = stream_context_create($params); $fp = @fopen($url, 'rb', FALSE, $ctx); if ($fp) { $response = @stream_get_contents($fp); return $response; } else { return FALSE; } } #Ошибки при создании рассылок по протоколу IP2SMS.
<?php //https://www.cs.rutgers.edu/lcsr/research/nextbus/feed.php? //command=predictions&a=rutgers&r=wknd1&s=scott $postdata = http_build_query(array('command' => 'predictions', 'a' => 'rutgers', 'r' => 'wknd1', 's' => 'scott')); echo $postdata; $opts = array('http' => array('method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $postdata)); $context = stream_context_create($opts); echo $context . '/n'; //$result = file_get_contents('https://www.cs.rutgers.edu/lcsr/research/nextbus/feed.php', //$context); $result = post_request('https://www.cs.rutgers.edu/lcsr/research/nextbus/feed.php', $context); //echo $result;
function doRegistration() { global $data_toreg, $projectId, $host, $protocol, $cookie_file; foreach ($data_toreg as $idx => $regdata) { if ($data_toreg[$idx][5] == 0) { $metadata_file = $regdata[1]; $metadata_content = $regdata[2]; $filename = $regdata[3]; print "<br>Uploading file : " . $filename . "<br>"; print "Send : " . filesize($filename) % 1024 . " kB " . date("F d Y H:i:s.", fileatime($filename)) . "<br>"; ob_flush(); flush(); // TODO: this does not appear to be a valid URL. api directory was in /php/api which would not be reached by this path. /php/api is now /hserver/controller $url = $protocol . $host . "/api/upload?uploadedItem=" . urlencode($metadata_file); $postdata = array(API_FIELD_PROJECT_ID => $projectId, API_FIELD_RECORD => $metadata_content, API_FIELD_UPLOAD_FILE => "@" . $filename, "fileAccessRestriction" => "PUBLIC"); //, API_FIELD_UPLOAD_FILE => ); //$data_toreg[$idx][5] = 1; //continue; $resp = post_request($url, null, null, $postdata, $cookie_file, false); //WORKS! // TO DO: TEMPORARY VERSION FOR TESTING, REPLACE WITH PARAMETEREISERD VERSION ABOVE //$resp = http_post("115.146.85.232", "8080", "/api/upload", $fusername, $fpwd, $postdata); //$postdata = array("loginUsername"=>$fusername, "loginPassword"=>$fpwd); //$resp = http_post("115.146.85.232","8080", "/login/process", null, null, $postdata); $regid = 0; //print "tDAR server response:"; //print "<xmp>".$resp."</xmp>"; if ($resp) { $resp = new SimpleXMLElement($resp); if ($resp->status == 'created') { $regid = $resp->recordId; print "Registred with id: " . $regid . "<br>"; } else { $regid = -1; print "<p class='error'>'FAILURE:</p><xmp>" . $resp->message . "</xmp><br>"; } } else { $regid = -2; print "<p class='error'>'Server does not return responce. It is assumed that registration is OK</p>"; } ob_flush(); flush(); //<apiResult> <status>badrequest</status> <message //<apiResult> <status>created</status> <recordId>6923</recordId> <message>created:6923</message> </apiResult> //add ID to result $data_toreg[$idx][5] = $regid; } } //for }
$dlLang = 'fr'; } else { $dlLang = $_GET['lang']; } if ($dlLang === 'all') { $cats = array_unique(array_merge($dlTypes[$dlType]['fr'], $dlTypes[$dlType]['vo'])); } else { $cats = $dlTypes[$dlType][$dlLang]; } // ************************************* // REQUETTE à BINNEWS.IN // ************************************* $post_data = array('chkInit' => 1, 'edTitre' => $_GET['q'], 'chkTitre' => 'on', 'chkFichier' => 'on', 'chkCat' => 'on', 'cats' => $cats, 'edAge' => '', 'edYear' => ''); $nbResultsBinnews = 0; $startBinnews = microtime(true); $result = post_request('http://www.binnews.in/_bin/search2.php', $post_data); if ($result['status'] == 'ok') { $html = str_get_html($result['content']); $res = $html->find('table[id=tabliste]'); $table_resultats = $res[0]; if (!($table_resultats == null)) { $lignes = $table_resultats->find('tr[class=ligneclaire],tr[class=lignefoncee]'); foreach ($lignes as $ligne) { $nbResultsBinnews++; $ligne = str_get_html(preg_replace('/<table(.*?)>(.*?)<\\/table>/', '', $ligne->innertext())); // On supprime les sous-tables $l_type = $ligne->find('td', 1)->find('span', 0)->plaintext; $l_title = $ligne->find('a[class=c16]', 0)->plaintext; $l_lng = $ligne->find('td', 3)->plaintext . $ligne->find('td', 3)->find('img', 0)->getAttribute('alt'); $l_file = $ligne->find('td', 5)->plaintext; $l_taille = $ligne->find('td', 6)->plaintext;