http-post

unable to execute post request with authorization header

限于喜欢 提交于 2019-12-12 04:39:30
问题 I have an issue in angular 4 when I post a request API with Authorization header? addPost(body): Observable<any>{ const url = 'https://xxxxxx'; return this.http.post(URL, body, this.options) .map((res:Response) => { this.data = res.json(); }) } token comes from firebase auth afAuth.auth.currentUser.getIdToken() .then(token => { this.headers = new Headers({ 'Authorization': 'Bearer '+token }); this.headers.append('Content-Type', 'application/json'); this.options = new RequestOptions({ headers:

How to post image to facebook wall with graph api

牧云@^-^@ 提交于 2019-12-12 04:38:41
问题 I want tp post some text with image on facebook wall.I have this code from graph api which does that but i want to post my image from bundle and not from a link as this api does.Can anyone tell me how to post your own image rather then the link "[variables setObject:@"http://bit.ly/bFTnqd" forKey:@"link"];" on facebook wall. NSMutableDictionary *variables = [NSMutableDictionary dictionaryWithCapacity:4]; [variables setObject:@"this is a test message: postMeFeedButtonPressed" forKey:@"message"

AFNetworking sending NSMutableDictionary as POST

烂漫一生 提交于 2019-12-12 04:34:28
问题 Im new to using AFNetworking. I managed to make GET request work with some help from a nice guy here in stack overflow. Now im stuck in making a POST request. I try this code but i always end up in failed block. How come? -(void) postEventInfo: (NSMutableDictionary *) eventInfoObject{ NSURL *url = [NSURL URLWithString:string]; AFHTTPSessionManager *manager = [[AFHTTPSessionManager alloc] initWithBaseURL:url]; manager.requestSerializer = [AFJSONRequestSerializer serializer]; manager

How to POST list of objects as JSON from Android client to PHP REST API?

…衆ロ難τιáo~ 提交于 2019-12-12 04:33:29
问题 Scenario: REST API: PHP Slim Framework Android HTTP client library: loopj I am storing an ITEM as json string in sqlite. I want to POST this JSON on server. Each item is a record in my SQLite database. What I am currently doing? I have JSON with list of objects. I want to POST it to my PHP based REST API. Here is the code if (cursor != null && cursor.getCount() > 0) { if (cursor.moveToFirst()) { do { Item item = new Item(); try { item.setOfflineId(Long.parseLong(cursor.getString(0))); item

No auth in c2dm response

人走茶凉 提交于 2019-12-12 04:05:40
问题 When I'm trying to use POST to get the Auth token from the ac2dm service I only get the SID and LSID, not the Auth, has this happened to anyone else, if yes, how did you solve this? I'm using .NET (C#) on the server side, I have tried to send the post call with fiddler to but I'm getting the same result. Post call in fiddler: Content-Type: application/x-www-form-urlencoded Host: www.google.com Content-Length: 125 Expect: 100-continue accountType=HOSTED_OR_GOOGLE&Email=myRegistredMail&Passwd

Sending large data from a server to another

六月ゝ 毕业季﹏ 提交于 2019-12-12 04:05:09
问题 I am using CURL to send large amounts of data between servers , am using POST , is this OK or is there any better/standard way to send large serialized data with curl ? the problem is in the max-post-size in the php settings , i have to change it (default 2MB) . i didn't encounter any problems with this yet , but when the system will be online it is possible that data larger than 50MB will be sent each time ! Any ideas ? Thank you . EDIT : I am sending DATA and not FILES , a data that once

Simple XMLHttpRequest fails with Access-Control-Allow-Origin header null [duplicate]

旧时模样 提交于 2019-12-12 04:04:45
问题 This question already has answers here : Why does my JavaScript code get a “No 'Access-Control-Allow-Origin' header is present on the requested resource” error when Postman does not? (44 answers) Closed 3 years ago . I am trying to get a simple random quote from API exposed in here. It basically wants a POST request without any authorization. I want to achieve this using XMLHttpRequests. Here is the code: var xhr = new XMLHttpRequest(); var forismaticUrl = 'http://api.forismatic.com/api/1.0/'

send POST requests with Body in Android

断了今生、忘了曾经 提交于 2019-12-12 03:59:58
问题 I want to send a simple POST request in Android with a body equaling this : [{ "value": ["test"]}] Since the request is very very simple, I tried to do it using this code : try { URL url = new URL("******"); HttpsURLConnection connection = (HttpsURLConnection) url.openConnection(); //headers (all of them are simple strings) connection.setRequestMethod("POST"); connection.setRequestProperty("X-OAPI-Key", "123****"); connection.setRequestProperty("X-ISS-Key", "*******"); connection

HttpPost in android not working

吃可爱长大的小学妹 提交于 2019-12-12 03:56:14
问题 I am trying to connect to apache tomcat server using HTTP POST, when i see LOG file of server it showing GET /login/validate_doc.jsp HTTP/1.1" 200 685 , which means it is getting a GET request when i am sending using HttpPost and form parameters are not received by server. my code is below: HttpPost post_http=null; post_http=new HttpPost("http://somexx.ac.in/medONmob/validate_doc.jsp"); try { List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2); nameValuePairs.add(new

Reading RAW data from a Flash POST Request ( images )

孤街浪徒 提交于 2019-12-12 03:38:46
问题 I'm basically interacting with a third party API flash file to send HTTP POST requests to my server. I know I'm on somewhat the right path because it requires a crossdomain.xml file, and before I added that part nothing in the POST variables was showing up, however since I added that file there are 4 variables that are set, these POST variables are sent by the application to give me basic information about the file.. but I actually need to read the RAW POST data to actually save the image