三 Get請求與Post請求

2021-09-25 00:00:25 字數 803 閱讀 2079

public static string sendget(string url,string param)

}//定義bufferedreader輸入流來讀取url的響應

in=new bufferedreader(new inputstreamreader(connection.getinputstream()));

string line;

while((line=in.readline())!=null)

}catch(exception e){}

//使用finally塊來關閉輸入流

finally

}catch(exception e2){}

}return result;

}

post請求的引數需要通過urlconnection的輸出流來寫入引數

public static string sendpost(string url,string param)

}//讀取返回資訊部分與get請求類似

in=new bufferedreader(new inputstreamreader(conn.getinputstream()));

string line;

while((line=in.readline())!=null)

}catch(exception e){}

finally

if(in!=null)

}catch(ioexception ex){}

}return result;

前端日記 三 get請求與post請求

我傳送請求只有一種方式 就是axios.但是axios也分為get和post 1,get請求展示資料 findinformation 2,get請求修改資料 進行拼接 axios.get cpuandmemory update?cpu this.cpu memory this.memory then...

Get請求 Post請求

複製直接用 post同步請求 void synchronourequestbypost post非同步請求 1.方法 void asynchronourequestbypost void connection nsurlconnection connection didreceiveresponse...

get請求 post請求

今天由於群裡的人說出了這個問題,在這裡總結一下,順便加強記憶。get和post是http請求的兩種基本方法,要說它們的區別 直觀的區別就是get把引數包含在url中,post通過request body傳遞引數 本標準答案參考自w3schools 這只是乙個表面的並不是深層的更深一步理解 get和p...