public class MainActivity extends AppCompatActivity {
Where I set up the url and HttpUrlCoection which allows the program to read the contents of the url.
public class DownloadTask extends AsyncTask<String, Void, String>{
@Override
protected String doInBackground(String... urls) {
String result = "";
URL url;
HttpURLCoection urlCoection = null;
try{
url = new URL(urls[0]);
urlCoection =(HttpURLCoection)url.openCoection();
InputStream in = urlCoection.getInputStream();
InputStreamReader reader = new InputStreamReader(in);
int data = reader.read();
while(data != -1){
char current = (char) data;
result += current;
data =reader.read();
}
retu result;
}
catch(Exception e){
e.printStackTrace();
}
retu null;
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
DownloadTask task = new DownloadTask();
String result = null;
try {
result = task.execute("http://www.historyplace.com/specials/").get();
Log.i("Contents of URL", result);
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}
}
I believe my code is written correctly because the logCat does display a few lines of code. Unfortunately it does not display all of it. I am trying to first retrieve all of the code so I can use Regex to extract certain pictures and names for an educational school project.

