日韩天天综合网_野战两个奶头被亲到高潮_亚洲日韩欧美精品综合_av女人天堂污污污_视频一区**字幕无弹窗_国产亚洲欧美小视频_国内性爱精品在线免费视频_国产一级电影在线播放_日韩欧美内地福利_亚洲一二三不卡片区

WEB項目后端跨域請求_PHP教程

編輯Tag賺U幣
教程Tag:暫無Tag,歡迎添加,賺取U幣!

推薦:php簡單防刷計數(shù)器-PHP實例
[導(dǎo)讀] php簡單防刷計數(shù)器,lt;?phprequire_once'config.php';functioncounter{nbsp;session_start;nbsp; $sql=selectcounterfromcounter;nbsp;$result=@MySQL_query$sql;nbsp;if!empty$resultnbsp;{nbsp;$row=mysql_fetch_array$result;nbsp;$counter=++$row[co... ?ph

   using System;

  using System.Collections.Generic;

  using System.IO;

  using System.Linq;

  using System.Net;

  using System.Text;

  using System.Web;

  using System.Web.SessionState;

  namespace GL

  {

  public class CrossDomainHandler:IHttpModule, IRequiresSessionState

  {

  ///

  /// 釋放內(nèi)存

  ///

  public void Dispose()

  {

  }

  ///

  /// 開始請求

  ///

  ///

  public void Init(HttpApplication context)

  {

  //頁面開始請求時,綁定時間

  context.BeginRequest += new EventHandler(context_PreRequestHandlerExecute);

  }

  ///

  /// 請求處理

  ///

  ///

  ///

  void context_PreRequestHandlerExecute(object sender, EventArgs e)

  {

  HttpApplication app = (HttpApplication)sender;

  HttpContext context = app.Context;

  context.Response.AppendHeader("charset", "utf-8");

  context.Response.AppendHeader("defaultCharset", "utf-8");

  context.Response.AppendHeader("Content-Type", "text/html; charset=utf-8");

  var relativeAddr = context.Request.AppRelativeCurrentExecutionFilePath.Remove(0, 2);

  if (relativeAddr.StartsWith("Server"))

  {

  var url = string.Concat("http://localhost:89", relativeAddr.Substring(relativeAddr.IndexOf('/')));

  HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;

  request.Method = "POST";

  request.ContentType = "application/x-www-form-urlencoded";

  var rs = request.GetRequestStream();

  var sb = new StringBuilder("a=a&");

  context.Request.Form.AllKeys.ToList().ForEach(name =>

  {

  sb.AppendFormat("{0}={1}&", name, context.Request.Form[name]);

  });

  var str = sb.ToString();

  if(str.Contains('&'))

  {

  str = str.Substring(0, str.Length - 1);

  }

  var sw = new StreamWriter(rs, Encoding.UTF8);

  sw.Write(sb.ToString());

  sw.Close();

  request.Timeout = 60 * 1000;

  var response = request.GetResponse() as HttpWebResponse;

  var ps = response.GetResponseStream();

  var reader = new StreamReader(ps, Encoding.UTF8);

  string html = reader.ReadToEnd();

  ps.Close();

  context.Response.Write(html);

  context.Response.End();

  }

  }

  }

  }

分享:PHP下載google相冊到本地-PHP實例
PHP下載google相冊到本地,調(diào)用方式xxx.php?user=xxx保證程序放的當(dāng)前目錄可寫文件夾可寫文件默認存放方式為./用戶名/相冊1描述/圖片描述-1.圖片后綴lt;?phpfunctionopen$host,$file{$return=;$header='';... 調(diào)用方式 xxx.php?user=xxx 保證程序放的當(dāng)前目錄可寫文件夾

來源:模板無憂//所屬分類:PHP教程/更新時間:2015-01-30
相關(guān)PHP教程