get

400 Bad Request when getting a page with PHP Curl

佐手、 提交于 2019-12-07 12:18:23
问题 I keep getting a 400 bad request code from a hotfile.com page when I try to get it with curl. I can get the pages fine in the browser The first (login) (post) request in the script works The last (get) request in the for loop works I have tried setting the curl headers to the same headers sent by my browser I have tried sleeping up to 5 seconds between requests, to no difference The problem is all the curl get requests in the for loop return a 400 bad request except for the last one which is

Convert JSON data to querystring in C# GET request

假装没事ソ 提交于 2019-12-07 12:16:13
问题 What is the best way to convert a JSON object into querystrings to append to a GET Url? The POST is straight forward and gets read by my Web API backend. {Name: 'Mike' } = ?Name=Mike private static string MakeRequest(HttpWebRequest req, string data) { try { if (req.Method == Verbs.POST.ToString() || req.Method == Verbs.PUT.ToString() || req.Method == Verbs.DELETE.ToString()) { var encodedData = Encoding.UTF8.GetBytes(data); req.ContentLength = encodedData.Length; req.ContentType =

Android: Get single value from Hashmap Arraylist?

﹥>﹥吖頭↗ 提交于 2019-12-07 11:39:41
问题 So basically, I have a database that uses Hashmapping. After I run a query, I'd like to output the ID's and store it in an array in another activity. After that, I'd like to access a single element from the array. Here's my code for the database public ArrayList<HashMap<String, String>> getIDList() { ArrayList<HashMap<String, String>> IDList = new ArrayList<HashMap<String, String>>(); String selectQuery = "SELECT cardID FROM flashcards"; SQLiteDatabase database = this.getWritableDatabase();

Get text of view (button)

◇◆丶佛笑我妖孽 提交于 2019-12-07 11:19:41
问题 I have two column in relative layout. both column have few button with text. I want to draw a line using finger which join the button. Take the example of "match the following" like A ------------------- A. Above things are done. Now i want to get the text of button from where user start drawing the line and end the line. In above case is "A". Could any one please help me out. I want to get the text with Orange circle when user start drawing the line from finger and then text of the green

Meteor: Saving images from urls to AWS S3 storage

*爱你&永不变心* 提交于 2019-12-07 10:15:37
问题 I am trying, server-side, to take an image from the web by it's url (i.e. http://www.skrenta.com/images/stackoverflow.jpg) and save this image to my AWS S3 bucket using Meteor, the aws-sdk meteorite package as well as the http meteor package. This is my attempt, which indeed put a file in my bucket (someImageFile.jpg), but the image file is corrupted then and cannot be displayed by a browser or a viewer application. Probably I am doing something wrong with the encoding of the file. I tried

php object : get value of attribute by computed name

*爱你&永不变心* 提交于 2019-12-07 10:08:29
问题 How do I access an attribute of an object by name, if I compute the name at runtime? For instance. I loop over keys and want to get each value of the attributes "field_" . $key . In python there is getattribute(myobject, attrname) . It works, of course, with eval("$val=$myobject->".$myattr.";"); but IMO this is ugly - is there a cleaner way to do it? 回答1: Keep always in mind that a very powerful feature of PHP is its Variable Variables You can use $attr = 'field' . $key; $myobject->$attr; or

How can Flash scope help in implementing the PostRedirectGet (PRG) pattern in JSF2.0

☆樱花仙子☆ 提交于 2019-12-07 10:00:24
问题 I was reading Balusc blog on PRG pattern in JSF where it is mentioned that : This article is targeted on JSF 1.2. For JSF 2.0, this can easier be achieved using the new Flash scope. I wanted to find out how can flash scope help us in achieving the same ? 回答1: Call Flash#setKeepMessages() with true before render response phase to instruct JSF to store the faces messages in the flash scope and add faces-redirect=true query string parameter to the outcome to perform a redirect. public String

Encrypting Parameters in URLs

戏子无情 提交于 2019-12-07 08:40:29
I have a URL that looks like this: http://localhost:8001/jasperserver&reportUnit=somereport&username=cghan& password=somepasswrd As you can see, the password is in clear site, along with some other parameters. What's the best way to secure this? Set the method of the FORM (in HTML) to POST. That way attributes won't be shown in the URL (they can be retrieved exactly the same way). Anyway, for anyone with a sniffer, it will make little difference. If it is really important, force the server to use only HTTPS. gigadot Use SSL encryption, i.e. HTTPS. This makes it encrypted for everyone on the

Angular2 - Using POST with angular-in-memory-web-api

梦想的初衷 提交于 2019-12-07 07:59:00
问题 I am playing around with angular-in-memory-web-api for Angular 2. So far I have only been using GET calls and it's working well. The API I'm going to call is only using POST calls so I began rewriting my GET calls to POST calls, but then they stopped returning the mock data. In my test function bellow, I want to get the data as a TestResponse object by an id: postTest(id: string): Promise<TestResponse> { return this.http .post(this.testUrl, JSON.stringify({ testId: id }), { headers: this

Waiting for an answer from server on http request in Angular 2

China☆狼群 提交于 2019-12-07 05:21:31
问题 I have a little problem with my Angular2 app. I want to get some data from server for my user login, but my code is going ahead and I have a lot of bugs with it. I want to wait for answer from server, then do something with my data. This is my code: import { Injectable } from '@angular/core'; import { Http, Response, Headers } from '@angular/http'; import { Observable } from 'rxjs/Rx'; import { User } from './user'; @Injectable() export class UserService { public usersTmp: Array<Object> = new