• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP http_post_data函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中http_post_data函数的典型用法代码示例。如果您正苦于以下问题:PHP http_post_data函数的具体用法?PHP http_post_data怎么用?PHP http_post_data使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了http_post_data函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: actionSocial

 public function actionSocial()
 {
     $req = Yii::$app->request;
     $i = $req->get('i');
     $c = $req->get('c');
     $a = $req->get('a');
     //se inicia sesion en el ampache
     $Conexion = BaseJson::decode($this->actionConnectionParams());
     $datos = "";
     $peticionAmpache = http_post_data($Conexion["url"] . 'action=' . $Conexion['action'] . "&auth=" . $Conexion['auth'] . "&timestamp=" . $Conexion['timestamp'] . "&version=" . $Conexion['version'] . "&user=" . $Conexion['user'], $datos, array("timeout" => 1, "useragent" => ""));
     $peticionAmpache = substr($peticionAmpache, strpos($peticionAmpache, '<'));
     $peticionAmpache = substr($peticionAmpache, 0, -5);
     //return $peticionAmpache;
     $xml = simplexml_load_string($peticionAmpache);
     $token = $xml->auth;
     //se pide la informacion del album
     $peticionAmpache = http_post_data($Conexion["url"] . "auth=" . $token . "&action=album_songs&filter=" . $a, $datos);
     //return $peticionAmpache;
     $peticionAmpache = substr(substr($peticionAmpache, strpos($peticionAmpache, '<')), 0, -5);
     $xml = simplexml_load_string($peticionAmpache);
     //"renderizamos la vista"
     $salida = $this->render('index', ['urlimg' => $xml->song[0]->art, 'descripcion' => 'Escuchando ' . $xml->song[0]->album . ' en Radio Album!']);
     //le agregamos los parametros necesarios
     $salida .= '<div id="parametros" data-skin="' . $i . 'vplayer" data-album="' . $a . '" data-channel="' . $c . '"></div>' . $peticionAmpache;
     //mostramos la vista
     return $salida;
 }
开发者ID:coodesoft,项目名称:radioalbum,代码行数:27,代码来源:WpController.php


示例2: find

 public function find($email)
 {
     $data = array('EMAIL' => rawurldecode($email));
     $return_content = http_post_data("http://itandroidbalance.miyigame.com/getbaseurl2.php", json_encode(array('email' => $email, 'platform' => 'xiaomi')));
     $return = json_decode($return_content, true);
     $baseurl = $return["baseurl"];
     $db_group_var = "db1";
     if ($baseurl == "itofdp4.miyigame.com:40002") {
         $db_group_var = "db1";
     } elseif ($baseurl == "itofdp5.miyigame.com:40003") {
         $db_group_var = "db2";
     } elseif ($baseurl == "itofdp6.miyigame.com:40004") {
         $db_group_var = "db3";
     }
     $this->session->set_tempdata('db_group', $db_group_var, 600);
     $this->load->model(array('User_data', 'Character_data', 'Skill_data', 'Treasure_data', 'Game_data', 'Item_data', 'Shop_data', 'Message_data'));
     $userRows = $this->User_data->selectUser($data);
     if (count($userRows) == 0) {
         js_alert_back('Empty no data.');
     } else {
         if (count($userRows) == 1) {
             js_redirect(site_url(array('user', 'view', $userRows[0]['USER_ID'])));
         } else {
             $data['USER_ROWS'] = $userRows;
             $this->viewer->all('user/find', $data);
         }
     }
 }
开发者ID:letmefly,项目名称:tools_script,代码行数:28,代码来源:user.php


示例3: post

 function post($url, $fields = array(), $http_options = array())
 {
     $http_options = array_merge($this->http_options, $http_options);
     $res = is_array($fields) ? http_post_fields($url, $fields, array(), $http_options, $this->response_info) : http_post_data($url, $fields, $http_options, $this->response_info);
     $this->http_parse_message($res);
     return $this->response_object->body;
 }
开发者ID:rvyasg821,项目名称:rest-webservices,代码行数:7,代码来源:rest_client.php


示例4: fetchData

 protected function fetchData(Request $request)
 {
     $this->request = $request;
     include "getUA.php";
     $request_options = array("referer" => "http://api.irail.be/", "timeout" => "30", "useragent" => $irailAgent);
     $id = preg_replace("/.*?(\\d.*)/smi", "\\1", $request->getVehicleId());
     $this->scrapeURL .= "?l=" . $request->getLang() . "&s=1&tid=" . $id . "&da=D&p=2";
     $post = http_post_data($this->scrapeURL, "", $request_options) or die("");
     $body = http_parse_message($post)->body;
     return $body;
 }
开发者ID:janfabry,项目名称:iRail,代码行数:11,代码来源:BRailVehicleInput.php


示例5: httpcall

 private static function httpcall($url)
 {
     //maybe we should add the method to the config. Some servers have curl, some have this method:
     include "config.php";
     $request_options = array("referer" => "http://iRail.be/", "timeout" => "30", "useragent" => $iRailAgent);
     //echo $url;
     $post = http_post_data($url, "", $request_options) or die("");
     if ($post == "") {
         throw new Exception("Failed to contact the server");
     }
     return http_parse_message($post)->body;
 }
开发者ID:rubenslabbinck,项目名称:InfoScreen,代码行数:12,代码来源:APICall.class.php


示例6: getServerData

     private static function getServerData($id,$lang){
	  include_once("../includes/getUA.php");
	  $request_options = array(
	       "referer" => "http://api.irail.be/",
	       "timeout" => "30",
	       "useragent" => $irailAgent,
	       );
	  $scrapeURL = "http://www.railtime.be/mobile/HTML/TrainDetail.aspx";
	  $id = preg_replace("/.*?(\d.*)/smi", "\\1", $id);
	  $scrapeURL .= "?l=" . $lang . "&tid=" . $id . "&dt=" . date( 'd%2fm%2fY' );
	  $post = http_post_data($scrapeURL, "", $request_options) or die("");
	  return http_parse_message($post)->body;	  
     }
开发者ID:GMLudo,项目名称:iRail,代码行数:13,代码来源:vehicleinformation.php


示例7: internalCall

 /** Send a query using a specified request-method.
  *
  * @param	string	$query			Query to send. (Required)
  * @param	string	$requestMethod	Request-method for calling (defaults to 'GET'). (Optional)
  * @return	SimpleXMLElement		A SimpleXMLElement object.
  *
  * @access	protected
  * @internal
  */
 protected function internalCall($params, $requestMethod = 'GET')
 {
     /* Create caching hash. */
     $hash = Cache::createHash($params);
     /* Check if response is cached. */
     if ($this->cache != null && $this->cache->contains($hash) && !$this->cache->isExpired($hash)) {
         /* Get cached response. */
         $response = $this->cache->load($hash);
     } else {
         /* Build request query. */
         $query = http_build_str($params, '', '&');
         /* Set request options. */
         $options = array('useragent' => 'PHP last.fm API (PHP/' . phpversion() . ')');
         /* Clear response headers. */
         $this->headers = array();
         /* Get response */
         if ($requestMethod === 'POST') {
             $response = http_post_data(self::API_URL, $query, $options, $info);
         } else {
             $response = http_get(self::API_URL . '?' . $query, $options, $info);
         }
         $response = http_parse_message($response);
         foreach ($response->headers as $header => $value) {
             $this->headers[$header] = $value;
         }
         $response = $response->body;
         /* Cache it. */
         if ($this->cache != null) {
             if (array_key_exists('Expires', $this->headers)) {
                 $this->cache->store($hash, $response, strtotime($this->headers['Expires']));
             } else {
                 $expiration = $this->cache->getPolicy()->getExpirationTime($params);
                 if ($expiration > 0) {
                     $this->cache->store($hash, $response, time() + $expiration);
                 }
             }
         }
     }
     /* Create SimpleXMLElement from response. */
     $response = new SimpleXMLElement($response);
     /* Return response or throw an error. */
     if (Util::toString($response['status']) === 'ok') {
         if ($response->children()->{0}) {
             return $response->children()->{0};
         }
     } else {
         throw new Error(Util::toString($response->error), Util::toInteger($response->error['code']));
     }
 }
开发者ID:niczak,项目名称:php-last.fm-api,代码行数:58,代码来源:PeclCaller.php


示例8: fetchData

 private static function fetchData($station, $time, $lang, $timeSel)
 {
     include "../includes/getUA.php";
     $request_options = array("referer" => "http://api.irail.be/", "timeout" => "30", "useragent" => $irailAgent);
     $body = "";
     //we want data for 1 hour. But we can only retrieve 15 minutes per request
     for ($i = 0; $i < 4; $i++) {
         $scrapeUrl = "http://www.railtime.be/mobile/SearchStation.aspx";
         $scrapeUrl .= "?l=EN&tr=" . $time . "-15&s=1&sid=" . stations::getRTID($station, $lang) . "&da=" . $timeSel . "&p=2";
         $post = http_post_data($scrapeUrl, "", $request_options) or die("");
         $body .= http_parse_message($post)->body;
         $time = tools::addQuarter($time);
     }
     return $body;
 }
开发者ID:JeroenDeDauw,项目名称:iRail,代码行数:15,代码来源:liveboard.php


示例9: fetchData

 private static function fetchData($station, $time, $lang, $timeSel)
 {
     include "../includes/getUA.php";
     $request_options = array("referer" => "http://api.irail.be/", "timeout" => "30", "useragent" => $irailAgent);
     $body = "";
     //we want data for 1 hour. But we can only retrieve 15 minutes per request
     for ($i = 0; $i < 4; $i++) {
         $scrapeUrl = "http://www.railtime.be/mobile/HTML/StationDetail.aspx";
         $rt = stations::getRTID($station, $lang);
         $rtname = $rt->rtname;
         $rtid = $rt->rtid;
         $scrapeUrl .= "?sn=" . urlencode($rtname) . "&sid=" . urlencode($rtid) . "&ti=" . urlencode($time) . "&da=" . urlencode($timeSel) . "&l=EN&s=1";
         $post = http_post_data($scrapeUrl, "", $request_options) or die("");
         $body .= http_parse_message($post)->body;
         $time = tools::addQuarter($time);
     }
     return $body;
 }
开发者ID:GMLudo,项目名称:iRail,代码行数:18,代码来源:liveboard.php


示例10: get_dyn_pois

function get_dyn_pois($fw_dynamic)
{
    $conf_data = file_get_contents("poi_dp_dyn_conf.json");
    $conf = json_decode($conf_data, true);
    $sources = $fw_dynamic["sources"];
    $dyn_data = array();
    $n_sources = count($sources);
    for ($i = 0; $i < $n_sources; $i++) {
        $source = $sources[$i];
        $host = $source["host_type"];
        $type = $source["data_type"];
        if (array_key_exists('host_id', $source)) {
            $ids = $source["host_id"];
            $id = $source["host_id"][0];
        } else {
            $ids = array();
            $id = '';
        }
        switch ($conf["host_type"][$host]["method"]) {
            case "REST_GET":
                $url = $conf["host_type"][$host]["params"]["url"] . $id . $conf["host_type"][$host]["params"]["params"];
                $options = array('headers' => $conf["host_type"][$host]["params"]["headers"]);
                $output = http_get($url, $options);
                break;
            case "REST_POST":
                $i = 0;
                $data = $conf["host_type"][$host]["params"]["params"];
                foreach ($ids as $id) {
                    $data = str_replace('$' . $i++, $id, $data);
                }
                if (is_array($data)) {
                    $data = json_encode($data);
                }
                $output = http_post_data($conf["host_type"][$host]["params"]["url"], $data, array('headers' => $conf["host_type"][$host]["params"]["headers"]));
                break;
        }
        $data = http_parse_message($output)->body;
        // merge separate sources
        $mapped_data = map_data($conf["data_mapping"][$type], $data);
        $dyn_data = array_merge_r2($dyn_data, $mapped_data);
    }
    return $dyn_data;
}
开发者ID:Fiware,项目名称:webui.POIDataProvider,代码行数:43,代码来源:get_dyn_pois.php


示例11: refreshSession

 /**
  * Refreshes a user's session.
  *
  * @return true if refreshSession is successful
  */
 protected function refreshSession()
 {
     global $databaseURI;
     $_SESSION['SESSION'] = $this->hashData("md5", session_id() . $_SERVER['HTTP_USER_AGENT'] . $_SERVER['REMOTE_ADDR']);
     // create Session in DB
     $sessionbody = array('user' => $_SESSION['UID'], 'session' => $_SESSION['SESSION']);
     $sessionbody = json_encode($sessionbody);
     $url = "{$databaseURI}/session";
     http_post_data($url, $sessionbody, false, $message);
     // only true if session is created in DB
     if ($message == "201") {
         $_SESSION['SIGNED'] = true;
         $_SESSION['LASTACTIVE'] = $_SERVER['REQUEST_TIME'];
         $_SESSION['HTTP_USER_AGENT'] = $_SERVER['HTTP_USER_AGENT'];
         $_SESSION['IP'] = $_SERVER['REMOTE_ADDR'];
         return true;
     } else {
         return false;
     }
 }
开发者ID:sawh,项目名称:ostepu-system,代码行数:25,代码来源:AbstractAuthentication.php


示例12: fetchData

 protected function fetchData(Request $request)
 {
     include "getUA.php";
     $this->request = $request;
     $scrapeUrl = "http://www.railtime.be/mobile/SearchStation.aspx";
     $request_options = array("referer" => "http://api.irail.be/", "timeout" => "30", "useragent" => $irailAgent);
     $stationname = strtoupper($request->getStation());
     include "includes/railtimeids.php";
     if (array_key_exists($stationname, $railtimeids)) {
         $rtid = $railtimeids[$stationname];
     } else {
         throw new Exception("Station not available for liveboard", 3);
     }
     $this->arrdep = $request->getArrdep();
     $this->name = $request->getStation();
     $scrapeUrl .= "?l=" . $request->getLang() . "&s=1&sid=" . $rtid . "&da=" . substr($request->getArrdep(), 0, 1) . "&p=2";
     $post = http_post_data($scrapeUrl, "", $request_options) or die("");
     $body = http_parse_message($post)->body;
     return $body;
 }
开发者ID:janfabry,项目名称:iRail,代码行数:20,代码来源:BRailLiveboardInput.php


示例13: FormEvaluator

     $f = new FormEvaluator($_POST);
     $f->checkStringForKey('userName', FormEvaluator::REQUIRED, 'warning', Language::Get('main', 'invalidUserName', $langTemplate), array('min' => 1));
     $f->checkIntegerForKey('rights', FormEvaluator::REQUIRED, 'warning', Language::Get('main', 'invalidCourseStatus', $langTemplate), array('min' => 0, 'max' => 2));
     if ($f->evaluate(true)) {
         $foundValues = $f->foundValues;
         $userName = $foundValues['userName'];
         $rights = $foundValues['rights'];
         $URL = $databaseURI . '/user/user/' . $userName;
         $user = http_get($URL, true);
         $user = json_decode($user, true);
         if (isset($user['id'])) {
             $userId = $user['id'];
             $newUser = User::createCourseStatus($userId, $cid, $rights);
             $newUser = User::encodeUser($newUser);
             $URL = $databaseURI . '/coursestatus';
             http_post_data($URL, $newUser, true, $message);
             if ($message == "201") {
                 $addUserNotifications[] = MakeNotification('success', Language::Get('main', 'successAddUser', $langTemplate));
             } else {
                 $addUserNotifications[] = MakeNotification('error', Language::Get('main', 'errorAddUser', $langTemplate));
             }
         } else {
             $addUserNotifications[] = MakeNotification('error', Language::Get('main', 'invalidUserId', $langTemplate));
         }
     } else {
         if (!isset($addUserNotifications)) {
             $addUserNotifications = array();
         }
         $addUserNotifications = $addUserNotifications + $f->notifications;
     }
 } else {
开发者ID:sawh,项目名称:ostepu-system,代码行数:31,代码来源:CourseManagement.php


示例14: getStationFromName

    public static function getStationFromName($name, $lang)
    {
        //We can do a couple of things here:
        // * Match the name with something in the DB
        // * Give the name to hafas so that it returns us an ID which we can reuse - Doesn't work for external stations
        // * Do a hybrid mode
        // * match from location
        // * match railtime name
        //Let's go wih the hafas solution and get the location from it
        //fallback for wrong hafas information
        if (strtolower($name) == "brussels north" || strtolower($name) == "brussel noord" || strtolower($name) == "bruxelles nord") {
            return stations::getStationFromLocation(4.360854, 50.859658, $lang);
        }
        if (strtolower($name) == "vorst zuid") {
            return stations::getStationFromLocation(4.310025, 50.810158, $lang);
        }
        include "../includes/getUA.php";
        $url = "http://hari.b-rail.be/Hafas/bin/extxml.exe";
        $request_options = array("referer" => "http://api.irail.be/", "timeout" => "30", "useragent" => $irailAgent);
        $postdata = '<?xml version="1.0 encoding="iso-8859-1"?>
<ReqC ver="1.1" prod="iRail API v1.0" lang="' . $lang . '">
<LocValReq id="stat1" maxNr="1">
<ReqLoc match="' . $name . '" type="ST"/>
</LocValReq>
</ReqC>';
        $post = http_post_data($url, $postdata, $request_options) or die("");
        $idbody = http_parse_message($post)->body;
        preg_match("/x=\"(.*?)\".*?y=\"(.*?)\"/si", $idbody, $matches);
        $x = $matches[1];
        $y = $matches[2];
        preg_match("/(.)(.*)/", $x, $m);
        $x = $m[1] . "." . $m[2];
        preg_match("/(..)(.*)/", $y, $m);
        $y = $m[1] . "." . $m[2];
        return stations::getStationFromLocation($x, $y, $lang);
    }
开发者ID:JeroenDeDauw,项目名称:iRail,代码行数:36,代码来源:stations.php


示例15: http_parse_message

//echo $url . "<br>";
//echo $data . "<br>";
//echo $request_options . "<br>";
$body = http_parse_message($post)->body;
//This code fixes most hated issue #2 →→ You can buy me a beer in Ghent at anytime if you leave me a message at +32484155429
$dummy = preg_match("/(query\\.exe\\/..\\?seqnr=1&ident=.*?).OK.focus\" id=\"formular\"/si", $body, $matches);
if ($matches[1] != "") {
    //DEBUG:echo $matches[1];
    //scrape the date & time layout from $body
    preg_match("/value=\"(.., ..\\/..\\/..)\" onblur=\"checkWeekday/si", $body, $datelay);
    $datelay[1] = urlencode($datelay[1]);
    preg_match("/name=\"REQ0JourneyTime\" value=\"(..:..)\"/si", $body, $timelay);
    $timelay[1] = urlencode($timelay[1]);
    $passthrough_url = "http://hari.b-rail.be/HAFAS/bin/" . $matches[1] . "&queryPageDisplayed=yes&REQ0JourneyStopsS0A=1%26fromTypeStation%3Dhidden&REQ0JourneyStopsS0K=S-0N1&REQ0JourneyStopsZ0A=1%26toTypeStation%3Dhidden&REQ0JourneyStopsZ0K=S-1N1&REQ0JourneyDate=" . $datelay[1] . "&wDayExt0=Ma|Di|Wo|Do|Vr|Za|Zo&REQ0JourneyTime=" . $timelay[1] . "&REQ0HafasSearchForw=1&REQ0JourneyProduct_prod_list=" . $trainsonly . "&start=Submit";
    //DEBUG:echo "\n". $passthrough_url;
    $post = http_post_data($passthrough_url, null, $request_options);
    $body = http_parse_message($post)->body;
}
// check if nmbs planner is down
if (strstr($body, "[Serverconnection]") && strstr($body, "[Server]")) {
    $down = 1;
} else {
    $down = 0;
}
$body = strstr($body, '<table CELLSPACING="0" CELLPADDING="0" BORDER="0" WIDTH="100%" BGCOLOR="#FFFFFF">');
if ($body == "" && $down == 0) {
    header('Location: noresults');
} else {
    $body = str_replace('<table CELLSPACING="0" CELLPADDING="0" BORDER="0" WIDTH="100%" BGCOLOR="#FFFFFF">', '<table CELLSPACING="0" CELLPADDING="0" BORDER="0" BGCOLOR="#FFFFFF">', $body);
    $body = str_replace("<img ", "<img border=\"0\" ", $body);
    $body = str_replace("<td ", "<td NOWRAP ", $body);
开发者ID:janfabry,项目名称:iRail,代码行数:31,代码来源:query_int.php


示例16: http_post_data

    $baseurl = "";
    $return_content = http_post_data("http://itandroidbalance.miyigame.com:35001/getbaseurl2.php", json_encode(array('email' => $user_row["email"], 'platform' => 'xiaomi')));
    $ret = json_decode($return_content, true);
    $baseurl = $ret['baseurl'];
    $user3["baseurl"] = $baseurl;
    // 2. register user
    $data = array('email' => $user_row['email'], 'password' => '1003');
    $json_data = json_encode($data);
    $url = $baseurl . "/index.php/v22/user/Join";
    print_r($url . "\r\n");
    print_r($json_data . "\r\n");
    $return_content = http_post_data($url, encrypt_rc4($json_data));
    //print_r(decrypt_rc4($return_content));
    print_r("\r\n");
    print_r("\r\n");
    // 3. login
    $data = array('email' => $user_row['email'], 'password' => '1003', 'device' => 'php', 'os' => 'mac');
    $json_data = json_encode($data);
    $url = $baseurl . "/index.php/v22/user/Login";
    print_r($url . "\r\n");
    print_r($json_data . "\r\n");
    $return_content = http_post_data($url, encrypt_rc4($json_data));
    //print_r(decrypt_rc4($return_content));
    print_r("\r\n");
    print_r("\r\n");
    $user_info = json_decode(decrypt_rc4($return_content), true);
    $user_id = $user_info["userID"];
    $user3["user_id"] = $user_id;
    array_push($pay_user3, $user3);
}
file_put_contents("pay_user3.json", json_encode($pay_user3));
开发者ID:letmefly,项目名称:tools_script,代码行数:31,代码来源:create_pay_user.php


示例17: http_post_data

<?php

$clientId = Symphony::Configuration()->get('client_id', 'githuboauth');
$secret = Symphony::Configuration()->get('secret', 'githuboauth');
$redirectUrl = Symphony::Configuration()->get('token_redirect', 'githuboauth');
if (isset($_REQUEST['code'])) {
    $code = $_REQUEST['code'];
    $url = 'https://github.com/login/oauth/access_token';
    $post = 'client_id=' . $clientId . '&client_secret=' . $secret . '&code=' . $code;
    if (function_exists('http_post_data')) {
        $result = http_post_data($url, $post);
        $result = http_parse_message($result);
        $result = $result->body;
    } else {
        if (function_exists('curl_version')) {
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, $url);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
            $result = curl_exec($ch);
            curl_close($ch);
        } else {
            echo 'Failed to post HTTP.';
            exit;
        }
    }
    $headers = explode('&', trim($result));
    foreach ($headers as $item) {
        $header = explode('=', $item);
        if ($header[0] == 'access_token') {
            $token = $header[1];
开发者ID:remie,项目名称:GitHubOAuth,代码行数:31,代码来源:content.authorize.php


示例18: switch

<br>
<br>
<?php 
echo $method;
?>
 Host Response:<br>
</b>
<pre>
<?php 
// Main function:
switch ($method) {
    case "GET":
        $response = http_get($url);
        break;
    case "POST":
        $response = http_post_data($url, $data);
        break;
    case "PUT":
        $response = http_put_data($url, $data);
        break;
    case "DELETE":
        echo "DELETE NOT SUPPORTED: {$url}";
        exit;
}
//list($head,$body) = explode("{",$response);
echo $response;
echo "<b><h3><br>JSon pretty print:<br></h3></b>";
$json = http_parse_message($response)->body;
echo json_encode(json_decode($json), JSON_PRETTY_PRINT);
?>
</pre>
开发者ID:Fiware,项目名称:webui.POIDataProvider,代码行数:31,代码来源:index.php


示例19: print_r

// print_r("\r\n");
// print_r("api login ...\r\n");
// $url = "http://127.0.0.1/ramboat/login.php";
// $msg = array (
// 	"userId" => "frankyuan",
// );
// $data = json_encode($msg);
// list($return_code, $return_content) = http_post_data($url, $data);
// print_r($return_code);
// print_r($return_content);
// print_r("\r\n");
// print_r("api modify ...\r\n");
// $url = "http://127.0.0.1/ramboat/modify.php";
// $msg = array (
// 	"userId" => "sjy0079",
// 	"name" => "HuangCe",
// 	"icon" => "icon3"
// );
// $data = json_encode($msg);
// list($return_code, $return_content) = http_post_data($url, $data);
// print_r($return_code);
// print_r($return_content);
// print_r("\r\n");
print_r("api update api ...\r\n");
$url = "http://localhost/v2/register.php";
$msg = array("userId" => "RamboatRamboatRamboat30", "name" => "TestUserFromBBS_004", "pw" => "1234", "icon" => "0", "score" => 2012, "military" => 1, "ship" => 0);
$data = json_encode($msg);
list($return_code, $return_content) = http_post_data($url, $data);
print_r($return_code);
print_r($return_content);
print_r("\r\n");
开发者ID:letmefly,项目名称:php_ramb,代码行数:31,代码来源:testapi.php


示例20: preauthcode

 /**
  * 微信预授权码的获取与过期检查
  * Created by Jh.
  * User: jh
  * Date: 15-06-08 9:45 AM
  * Modify Date: 15-06-15 
  * Mail: [email protected]
  */
 public static function preauthcode()
 {
     $db = M('account');
     $result = $db->where('id=1')->find();
     // if(time()-$result['preauthcode_c_time']>$result['preauthcode_e_time']-10 || empty($result['preauthcode'])){
     $data['component_appid'] = 'wxef0739105b12ff8d';
     $data = json_encode($data);
     $token = self::access_token();
     $url = 'https://api.weixin.qq.com/cgi-bin/component/api_create_preauthcode?component_access_token=' . $token;
     //echo $url;die;
     $result = http_post_data($url, $data);
     $preauthcode = json_decode($result[1], true);
     $t['preauthcode'] = $preauthcode['pre_auth_code'];
     $t['preauthcode_c_time'] = time();
     $t['preauthcode_e_time'] = $preauthcode['expires_in'];
     M('account')->where('id=1')->save($t);
     return $t['preauthcode'];
     // }else{
     //    return $result['preauthcode'];
     // }
 }
开发者ID:blackcocwhite,项目名称:quke8_wechat,代码行数:29,代码来源:ReceiveController.class.php



注:本文中的http_post_data函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP http_redirect函数代码示例发布时间:2022-05-15
下一篇:
PHP http_post函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap