Home > Mobile >  Android studio how to invoke a PHP interface to get content
Android studio how to invoke a PHP interface to get content

Time:09-23

Request address:
https://api.xxxc.xx/xxxxxx/w.php
Request: GET
Request code: interface: charset parameters: UTF8/GBK (must be capitalized, the default UTF8)
Request parameters: interface: code parameters: js (null returns plain text)

Trouble, had better have source reference, thank you thank you!

CodePudding user response:

Use okhttp or volley, or their asynchronous invocation HttpURLConnection

CodePudding user response:

Recommend a learning website play android

CodePudding user response:

The same guy, either PHP or what, all the same, I can give you a request of tools

CodePudding user response:

The String url=address;

ArrayList The header=new ArrayList<> (a);

//add the header parameter. According to the condition of their fixed
Header. The add (new ApiOkHttpClient. HeaderEntity (" the content-type ", "application/octet - stream"));

//add a token, don't need to add to format your fill out
The header. The add (new ApiOkHttpClient. HeaderEntity (" Authorization ", "Basic" + User. ShareUser () getToken ()));


ApiOkHttpClient. ShareClient (). The Get (url, headers, this new ApiOkHttpClient. MyNetCall () {

@ Override

Public void success (Response Response) throws IOException {

If (the response code ()==200) {
//return to normal processing
}

@ Override

Public void failed (IOException e) {
//error return processing
}

});

CodePudding user response:

Utility class
Copy this paragraph after open the baidu network backup phone App, operation more convenient oh links: https://pan.baidu.com/s/13DELXXl1ukXxz1ixIjuWlw extraction code: 2 co9
  • Related