1. 取得请求行:Method、URI、协议
可以从超级变量$_SERVER中获得,三个变量的值如下:
$_SERVER[‘REQUEST_METHOD’].’ ‘.$_SERVER[‘REQUEST_URI’].’ ‘.$_SERVER[‘SERVER_PROTOCOL’]."";
2. 取得所有Header
PHP有个内置函数getallheader(),是apache_request_headers()函数的一个别名,可以将HTTP请求的所有Header以数组形式返回。但这个函数只能工作在Apache下,如果换了Nginx或者命令行,会直接报函数不存在的错误。
比较通用的方法是,从超级变量$_SERVER中提取出来,有关Header的键值都是“HTTP_”开头的,可以根据此特点取得所有的Header。代码如下:
function get_all_headers() {
$headers = array();
foreach($_SERVER as $key => $value) {
if(substr($key, 0, 5) === ‘HTTP_’) {
$key = substr($key, 5);
$key = strtolower($key);
$key = str_replace(‘_’, ‘ ‘, $key);
$key = ucwords($key);
$key = str_replace(‘ ‘, ‘-‘, $key);
$headers[$key] = $value;
}
}
return $headers;
}
3. 取得Body
官方提供了一种获取请求Body的方法,即:
file_get_contents(‘php://input’)
4. 最终代码
/**
* 获取HTTP请求原文
* @return string
*/
function get_http_raw() {
$raw = ”;
// (1) 请求行
$raw .= $_SERVER[‘REQUEST_METHOD’].’ ‘.$_SERVER[‘REQUEST_URI’].’ ‘.$_SERVER[‘SERVER_PROTOCOL’]."";
// (2) 请求Headers
foreach($_SERVER as $key => $value) {
if(substr($key, 0, 5) === ‘HTTP_’) {
$key = substr($key, 5);
$key = str_replace(‘_’, ‘-‘, $key);
$raw .= $key.’: ‘.$value."";
}
}
// (3) 空行
$raw .= "";
// (4) 请求Body
$raw .= file_get_contents(‘php://input’);
return $raw;
}
波比源码 » PHP取得HTTP请求的原文
levaquin 500mg pill levaquin 250mg uk
purchase dutasteride pill cost avodart 0.5mg order zofran for sale
buy aldactone 100mg sale fluconazole price fluconazole medication
order ampicillin 250mg without prescription order bactrim 480mg generic order erythromycin 250mg for sale
sildenafil pill buy generic robaxin 500mg methocarbamol online order
sildenafil 50mg pill generic aurogra 50mg estrace 2mg sale
lamictal pills mebendazole us tretinoin over the counter
tadalis buy online cost avanafil 200mg voltaren us
isotretinoin 10mg tablet purchase accutane without prescription zithromax pills
indocin 75mg tablet suprax 200mg generic trimox cost
accutane 10mg drug order amoxil 1000mg without prescription ivermectin covid
purchase doxycycline generic order doxycycline 200mg sale lasix 40mg usa
ramipril canada order azelastine 10 ml order astelin 10 ml generic
brand catapres 0.1 mg order meclizine 25 mg generic buy tiotropium bromide 9mcg sale
buspirone 5mg sale buspirone online order oxybutynin pill
hytrin 5mg price cheap actos order azulfidine 500 mg online cheap
order fosamax 70mg sale fosamax pills cheap famotidine 20mg
order benicar 10mg without prescription diamox 250 mg cheap buy diamox 250mg online
buy tacrolimus 1mg online order generic labetalol 100 mg ursodiol price
order isosorbide 40mg online purchase azathioprine cheap telmisartan 20mg
buy molnunat 200mg online cheap buy generic omnicef 300 mg purchase prevacid pill
sertraline 50mg oral sertraline pills viagra 50mg drug
order salbutamol online generic protonix 40mg 50mg viagra
cialis 20mg over the counter order viagra without prescription sildenafil tablets
order cialis 5mg online amantadine 100mg sale purchase symmetrel sale
buy generic revia revia price aripiprazole over the counter
purchase modafinil sale purchase stromectol pill ivermectin 12 mg over the counter
buy luvox generic buy duloxetine 20mg for sale glucotrol 5mg brand
azithromycin generic order generic neurontin 100mg order gabapentin 100mg pill
cialis pills 10mg levitra or cialis order generic clomipramine
generic itraconazole progesterone order online tindamax without prescription
cheap metformin cheap lipitor 10mg cialis for women
cost amlodipine 10mg buy generic sildenafil 50mg buy tadalafil 20mg pills
order clozapine without prescription combivent for sale decadron uk
viagra pills viagra online order generic lisinopril 5mg
omeprazole online order prilosec 20mg cheap casino moons online casino
buy levitra 10mg pill medrol without a doctor prescription methylprednisolone price
buy clomid sale order clomiphene online blackjack online game
buy aristocort pill order aristocort 4mg without prescription order desloratadine 5mg sale
buy orlistat 60mg sale buy acyclovir pills acyclovir 800mg brand
tadalafil 10mg us order tadalafil 5mg generic plavix generic
methotrexate 5mg tablet generic metoclopramide 20mg reglan generic
motilium buy online flexeril 15mg over the counter flexeril price
losartan price esomeprazole us buy topamax 100mg online cheap
ozobax buy online buy toradol 10mg generic order toradol without prescription
ranitidine 150mg without prescription celecoxib 200mg pill order celebrex 200mg pills
free online roulette golden nugget online casino slots free
cialis 5mg brand order cipro 1000mg online cipro uk
cephalexin 125mg cost cleocin price erythromycin sale
best casino online tadalafil cost purchase cialis online cheap
order trazodone 100mg sale buy trazodone pill sildenafil 100mg price
sildenafil women buy estradiol 2mg pills order lamotrigine 200mg for sale
order deltasone 40mg without prescription amoxicillin 250mg uk amoxicillin 1000mg brand
viagra oral cheap sildenafil online cialis online buy
zithromax canada order azithromycin online order gabapentin 800mg online cheap
buy prednisone 5mg generic buy prednisone 20mg generic vermox without prescription
buy fildena 100mg online cheap nolvadex 20mg order rhinocort pills
retin for sale online order avana generic avana 100mg brand
order tadacip 10mg generic buy diclofenac 50mg purchase indomethacin online cheap
order tiotropium bromide 9 mcg online spiriva for sale online hytrin pills
singulair 5mg drug sildenafil next day delivery usa order viagra 100mg online cheap
buy cialis 20mg online cheap Low price cialis online casino with free signup bonus real money usa
doxycycline 100mg brand order doxycycline 200mg for sale methylprednisolone 4 mg without prescription
best ed drugs medications for ed buy propecia
purchase prednisolone online furosemide for sale online lasix 100mg cost
order generic vibra-tabs purchase levitra generic zovirax 800mg without prescription
buy avodart online buy xenical 120mg generic buy xenical 120mg
Thank you for great article. Hello Administ . Metropol Halı Karaca Halı Öztekin ve Selçuklu Halı Cami Halısı ve Cami Halıları Türkiye’nin En Büyük Cami Halısı Fabrikasıyız…
azathioprine 25mg pills buy naproxen pill buy naprosyn 250mg online cheap
При психоанализе о многом может сказать такое явление, как отрицание.
Аналогичным этому процессу является ситуация, когда человек, как говорится, «накликает» беду.
«Радостно, что у меня так давно не болела голова!» – это
отрицание может быть предчувствием приступа.
Отрицание – это как бы сигнал бессознательного, его предупреждение.
Но этот сигнал пока еще нельзя назвать
признанием того, что было вытеснено психическим
механизмом защиты. Психоаналитик должен
помочь преобразовать это отрицание в
осознание того, что хочет сказать
бессознательное и принять
вытесненное. Почему я потеряла интерес к жизни?
order uroxatral 10mg without prescription uroxatral 10 mg over the counter diltiazem 180mg cost