这就是我用.NET调用服务的方式:
var requestedURL = "https://accounts.google.com/o/oauth2/token?code=" + code + "&client_id=" + client_id + "&client_secret=" + client_secret + "&redirect_uri=" + redirect_uri + "&grant_type=authorization_code";
HttpWebRequest authRequest = (HttpWebRequest)WebRequest.Create(requestedURL);
authRequest.ContentType = "application/x-www-form-urlencoded";
authRequest.Method = "POST";
WebResponse authResponseTwitter = authRequest.GetResponse();
Run Code Online (Sandbox Code Playgroud)
但是当调用此方法时,我得到:
异常详细信息:System.Net.WebException:远程服务器返回错误:(411)Length Required.
我该怎么办?
我试图从服务器获取数据.我使用NSURLConnectionDelegate,NSURLConnectionDataDelegate.有代码(Objective-C).
-(void)sendRequest
{
NSURL* url = [[NSURL alloc] initWithString:@"http://SomeServer"];
NSMutableURLRequest* request = [[NSMutableURLRequest alloc] init];
NSString* reqBody = [NSString stringWithFormat:@"<tag>Content</tag>"];
NSData* reqData = [reqBody dataUsingEncoding:NSUTF8StringEncoding];
NSInputStream* stream = [NSInputStream inputStreamWithData:reqData];
[request setURL:url];
[request setHTTPBodyStream:stream];
[request setHTTPMethod:@"POST"];
self.wpData = [[NSMutableData alloc] init];
NSURLConnection* conection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
[conection start];
}
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
[self.wpData setLength:0];
}
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)d {
NSString* str = [[NSString alloc] initWithData:d encoding:NSUTF8StringEncoding];
NSLog(@"RESPONSE DATA: %@",str);
[self.wpData appendData:d];
}
Run Code Online (Sandbox Code Playgroud)
但是当我使用时,我得到"411 …
objective-c nsurlconnection nsurlrequest ios http-status-code-411
当我尝试从SVN签出项目时,我收到以下错误
RA layer request failed
svn: DAV request failed: 411 Content length required. The server or an intermediate proxy does not accept chunked encoding. Try setting 'http-chunked-requests' to 'auto' or 'no' in your client configuration.
Run Code Online (Sandbox Code Playgroud)
我搜索了很多论坛,他们说问题已经解决,但我仍然面临这个问题,我正在使用以下版本的SVN客户端.
同样在Eclipse中我也无法使用tigris客户端下载项目.
TortoiseSVN 1.8.6, Build 25419 - 64 Bit , 2014/04/12 11:40:48
Subversion 1.8.8, -release
apr 1.5.0
apr-util 1.5.3
serf 1.3.4
OpenSSL 1.0.1g 7 Apr 2014
zlib 1.2.8
Run Code Online (Sandbox Code Playgroud)
请帮帮我怎么办?我无法结账项目.
我正在尝试将通知实施到我的Web应用程序中。我有这个php文件,我在其中发送通知:
<?php
function sendGCM($title,$message, $id) {
$url = 'https://fcm.googleapis.com/fcm/send';
$fields = array (
'registration_ids' => array (
$id
),
"notification" => array(
"title" => $title,
"body" => $message,
"click_action" => "https://google.com"
)
);
$fields = json_encode ( $fields );
$headers = array (
'Authorization: key=' . $MY_KEY,
'Content-Type: application/json'
);
$ch = curl_init ();
curl_setopt ( $ch, CURLOPT_URL, $url );
curl_setopt ( $ch, CURLOPT_POST, true );
curl_setopt ( $ch, CURLOPT_HTTPHEADER, $headers );
curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt ( …Run Code Online (Sandbox Code Playgroud) .net ×1
c# ×1
firebase ×1
httprequest ×1
ios ×1
nsurlrequest ×1
objective-c ×1
php ×1
svn ×1
tortoisesvn ×1