**://post提交的引數,格式如下:
//引數1名字=引數1資料&引數2名字=引數2資料&引數3名字=引數3資料&...
nslog(@"post:%@",post);
//將nssrring格式的引數轉換格式為nsdata,post提交必須用nsdata資料。
nsdata *postdata = [post datausingencoding:nsutf8stringencoding allowlossyconversion:yes];
//計算post提交資料的長度
nsstring *postlength = [nsstring stringwithformat:@"%d",[postdata length]];
nslog(@"postlength=%@",postlength);
//定義nsmutableurlrequest
nsmutableurlrequest *request = [[[nsmutableurlrequest alloc] init] autorelease];
//設定提交目的url
[request seturl:[nsurl urlwithstring:kuserlogincheckurl]];
//設定提交方式為 post
//設定http-header:content-type
//設定http-header:content-length
//設定需要post提交的內容
//定義
//同步提交:post提交並等待返回值(同步),返回值是nsdata型別。
nsdata *responsedata = [nsurlconnection sendsynchronousrequest:request returningresponse:&urlresponse error:&error];
//將nsdata型別的返回值轉換成nsstring型別
nsstring *result = [[nsstring alloc] initwithdata:responsedata encoding:nsutf8stringencoding];
nslog(@"user login check result:%@",result);
if ([@"success" compare:result]==nsorderedsame)
return no;
axios提交post資料
以json形式提交 axios.post url,then res catch res 如果後端人員比較老派,沒法接受json格式,那就給他提交formdata var fd newformdata fd.key value let config axios.post url,fd,config t...
POST提交資料方式
當直接提交form表單時,預設就使用此種方式。這又是乙個常見的 post 資料提交的方式。我們使用表單上傳檔案時,必須讓 form 的 enctyped 等於這個值。上傳資料使用,不過多闡述。json 格式支援比鍵值對複雜得多的結構化資料,這一點也很有用。記得我幾年前做乙個專案時,需要提交的資料層次...
php模擬post提交資料
php模擬post提交資料,用處很多,可用來 的採集,登陸等等。以程式登陸乙個論壇登入為例 php post資料的三種方法 php有三種方法可以post資料,分別為curl socket file get contents socket版本 使用方法 request by socket facebo...