return view ('auth.show-site', ['name' => 'James']);
package ru.ls;
import android.net.Uri;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Scanner;
public class NetworkUtils {
/*************************************************************
* Генирируем ЮРЛ по ID пользователя и ....
************************************************************/
//переменые для составлении ссылки
public static final String API_URL_BASE = "https://eintel.arttopia.ru/";
public static final String API_METOD = "search.php";
public static final String API_USER_ID = "id";
// public static final String API_TOKEN = "access_token";
//Собираем ссылку
public static URL generateURL (String userId, String phoneId){
Uri builtUri = Uri.parse(API_URL_BASE + API_METOD)
.buildUpon()
.appendQueryParameter(API_USER_ID, userId)
// .appendQueryParameter(API_VERSION, "5.120")
.build();
URL url = null;
try {
url = new URL(builtUri.toString());
} catch (MalformedURLException e) {
e.printStackTrace();
}
return url;
}
//для того чтобы убрать перенос строк и сделать URl одной строкой
public static String getResponseFromURL (URL url) throws IOException {
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
try {
InputStream in = urlConnection.getInputStream();
Scanner scanner = new Scanner(in);
scanner.useDelimiter("\\A");
boolean hasInput = scanner.hasNext();
if(hasInput){
return scanner.next();
} else {
return null;
}
} finally {
urlConnection.disconnect();
}
}
}
//JSON
class QueryTask extends AsyncTask<URL, Void, String> {
@Override
protected String doInBackground(URL... url) {
String response = null;
try {
response = getResponseFromURL(url[0]);
} catch (IOException e) {
e.printStackTrace();
}
return response;
}
//вот тут вот то что вы хотели разбираем сам json
//JSON
class QueryTask extends AsyncTask<URL, Void, String> {
@Override
protected String doInBackground(URL... url) {
String response = null;
try {
response = getResponseFromURL(url[0]);
} catch (IOException e) {
e.printStackTrace();
}
return response;
}
@Override
protected void onPostExecute(String response) {
//Log.d(TAG,"response======"+response);
try {
//в response приходит Json
JSONObject jsonResponse = new JSONObject(response); //создаем Объект
// Создаем масив
JSONArray userInfoVKFNO = jsonResponse.getJSONArray("s1_h1_text");
JSONObject userInfoVKFNO_ = userInfoVKFNO.getJSONObject(0);
id = userInfoVKFNO_.getString("id");
text = userInfoVKFNO_.getString("text");
lang_id = userInfoVKFNO_.getString("lang_id");
} catch (JSONException e) {
e.printStackTrace();
}
}
}
{"s1_h1_text":[{"id":"1","text":"Заголовок 1-го уровня","lang_id":"1"}]}
$a = array (array(0=>"яблоко",
1=>"1-01-2019",
2=>"1"),
array(0=>"апельсин",
1=>"2-01-2019",
2=>"2"),
array(0=>"мандарин",
1=>"2-01-2019",
2=>"3"));
$table = '<table style="border:1px solid">
<tr style="border:1px solid">
<td style="border:1px solid">Название</td>';
foreach ($a as $value) {
$table .= ' <td style="border:1px solid">'.$value[1].'</td>';
}
$table .= ' </tr>';
foreach ($a as $value) {
$table .= '<tr style="border:1px solid">';
$table .= '<td style="border:1px solid">'.$value[0].'</td>';
$table .= str_repeat('<td style="border:1px solid"></td>', count($a));
$table .= '<td style="border:1px solid">'.$value[2].'</td>';
$table .= str_repeat('<td style="border:1px solid"></td>', 0);
$table .= '</tr>';
}
echo $table;
$('.url_trec_offer_ol').append('<li id="li_tracking_url">' +
'<a class="tracking_urls'+tracking_urls++ +'" href="Ваш URL - ' + tracking_urls_add_show_new_offer + '">' + tracking_urls_add_show_new_offer + '</a>' +
'<input size="10" type="text" id="sub_tracking_urls1" name="sub1" placeholder="sub1" value="">\n' +
'<input size="10" type="text" id="sub_tracking_urls2" name="sub2" placeholder="sub2" value="">\n' +
'<input size="10" type="text" id="sub_tracking_urls3" name="sub3" placeholder="sub3" value="">\n' +
'<input size="10" type="text" id="sub_tracking_urls4" name="sub4" placeholder="sub4" value="">\n' +
'<input size="10" type="text" id="sub_tracking_urls5" name="sub5" placeholder="sub5" value="">' +
'<input hidden type="text" id="tracking_urls' + index5++ + '" name="tracking_urls" value="' + tracking_urls_add_show_new_offer +'">' +
'</li>');