0

I'm trying to get the app to log in to this site "http://aluno.cefsa.edu.br/Login" and that after logging in I get the page information for which it redirects, but it is giving error. The site sends a post to "aluno.cefsa.edu.br/Login/Login" But JSOUP says that the url is not responding, I do not know why and I do not know if the way I'm doing to get the next page after login is right, if someone can help

Logcat

10-03 22:40:46.564 29058-29058/? E/Zygote: v2
10-03 22:40:46.564 29058-29058/? I/libpersona: KNOX_SDCARD checking this for 10388
10-03 22:40:46.564 29058-29058/? I/libpersona: KNOX_SDCARD not a persona
10-03 22:40:46.565 29058-29058/? E/Zygote: accessInfo : 0
10-03 22:40:46.566 29058-29058/? W/SELinux: SELinux selinux_android_compute_policy_index : Policy Index[2],  Con:u:r:zygote:s0 RAM:SEPF_SECMOBILE_7.0_0005, [-1 -1 -1 -1 0 1]
10-03 22:40:46.570 29058-29058/? I/SELinux: SELinux: seapp_context_lookup: seinfo=untrusted, level=s0:c512,c768, pkgname=com.destudios.tmedias 
10-03 22:40:46.578 29058-29058/? I/art: Late-enabling -Xcheck:jni
10-03 22:40:46.626 29058-29058/? D/TimaKeyStoreProvider: TimaKeyStore is not enabled: cannot add TimaSignature Service and generateKeyPair Service
10-03 22:40:46.720 29058-29058/com.destudios.tmedias W/System: ClassLoader referenced unknown path: /data/app/com.destudios.tmedias-1/lib/arm64
10-03 22:40:46.783 29058-29058/com.destudios.tmedias W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
10-03 22:40:46.836 29058-29058/com.destudios.tmedias D/TextView: setTypeface with style : 0
10-03 22:40:46.837 29058-29058/com.destudios.tmedias D/TextView: setTypeface /with style : 0
10-03 22:40:46.856 29058-29058/com.destudios.tmedias D/TextView: setTypeface with style : 0
10-03 22:40:46.857 29058-29058/com.destudios.tmedias D/TextView: setTypeface with style : 0
10-03 22:40:46.858 29058-29058/com.destudios.tmedias D/TextView: setTypeface with style : 0
10-03 22:40:46.862 29058-29058/com.destudios.tmedias D/TextView: setTypeface with style : 0
10-03 22:40:46.868 29058-29058/com.destudios.tmedias D/TextView: setTypeface with style : 0
10-03 22:40:46.870 29058-29058/com.destudios.tmedias D/TextView: setTypeface with style : 0
10-03 22:40:46.891 29058-29058/com.destudios.tmedias D/ViewRootImpl@f360f04[LoginActivity]: ThreadedRenderer.create() translucent=false
10-03 22:40:46.898 29058-29058/com.destudios.tmedias D/InputTransport: Input channel constructed: fd=58
10-03 22:40:46.900 29058-29058/com.destudios.tmedias D/ViewRootImpl@f360f04[LoginActivity]: setView = DecorView@3afcced[LoginActivity] touchMode=true
10-03 22:40:46.914 29058-29058/com.destudios.tmedias D/ViewRootImpl@f360f04[LoginActivity]: dispatchAttachedToWindow
10-03 22:40:46.958 29058-29058/com.destudios.tmedias D/ViewRootImpl@f360f04[LoginActivity]: Relayout returned: oldFrame=[0,0][0,0] newFrame=[0,0][1440,2560] result=0x27 surface={isValid=true 486657081856} surfaceGenerationChanged=true
10-03 22:40:46.958 29058-29058/com.destudios.tmedias D/ViewRootImpl@f360f04[LoginActivity]: mHardwareRenderer.initialize() mSurface={isValid=true 486657081856} hwInitialized=true
10-03 22:40:46.983 29058-29058/com.destudios.tmedias D/ScrollView:  onsize change changed 
10-03 22:40:46.992 29058-29105/com.destudios.tmedias D/libEGL: loaded /vendor/lib64/egl/libGLES_mali.so
10-03 22:40:47.020 29058-29105/com.destudios.tmedias I/OpenGLRenderer: Initialized EGL, version 1.4
10-03 22:40:47.020 29058-29105/com.destudios.tmedias D/OpenGLRenderer: Swap behavior 1
10-03 22:40:47.027 29058-29105/com.destudios.tmedias D/mali_winsys: EGLint new_window_surface(egl_winsys_display*, void*, EGLSurface, EGLConfig, egl_winsys_surface**, egl_color_buffer_format*, EGLBoolean) returns 0x3000,  [1440x2560]-format:1
10-03 22:40:47.112 29058-29058/com.destudios.tmedias D/ViewRootImpl@f360f04[LoginActivity]: MSG_RESIZED_REPORT: ci=Rect(0, 96 - 0, 0) vi=Rect(0, 96 - 0, 0) or=1
10-03 22:40:53.607 29058-29058/com.destudios.tmedias D/ViewRootImpl@f360f04[LoginActivity]: MSG_RESIZED: ci=Rect(0, 96 - 0, 1000) vi=Rect(0, 96 - 0, 1000) or=1
10-03 22:40:53.743 29058-29058/com.destudios.tmedias D/ViewRootImpl@f360f04[LoginActivity]: Relayout returned: oldFrame=[0,0][1440,2560] newFrame=[0,0][1440,2560] result=0x1 surface={isValid=true 486657081856} surfaceGenerationChanged=false
10-03 22:40:53.752 29058-29058/com.destudios.tmedias D/ScrollView:  onsize change changed 
10-03 22:40:53.843 29058-29064/com.destudios.tmedias I/art: Do partial code cache collection, code=20KB, data=23KB
10-03 22:40:53.863 29058-29064/com.destudios.tmedias I/art: After code cache collection, code=20KB, data=23KB
10-03 22:40:53.863 29058-29064/com.destudios.tmedias I/art: Increasing code cache capacity to 128KB
10-03 22:40:54.013 29058-29058/com.destudios.tmedias D/ViewRootImpl@f360f04[LoginActivity]: MSG_WINDOW_FOCUS_CHANGED 1
10-03 22:40:54.013 29058-29058/com.destudios.tmedias D/ViewRootImpl@f360f04[LoginActivity]: mHardwareRenderer.initializeIfNeeded()#2 mSurface={isValid=true 486657081856}
10-03 22:40:54.049 29058-29058/com.destudios.tmedias D/SEM_CLIP_SemClipboardManager: isCocktailBarDisplayed : false
10-03 22:40:54.055 29058-29058/com.destudios.tmedias D/SEM_CLIP_SemClipboardManager: isCocktailBarDisplayed : false
10-03 22:40:54.073 29058-29058/com.destudios.tmedias V/InputMethodManager: Starting input: tba=android.view.inputmethod.EditorInfo@4458506 nm : com.destudios.tmedias ic=com.android.internal.widget.EditableInputConnection@8c5a7c7
10-03 22:40:54.074 29058-29058/com.destudios.tmedias I/InputMethodManager: [IMM] startInputInner - mService.startInputOrWindowGainedFocus
10-03 22:40:54.105 29058-29072/com.destudios.tmedias D/InputTransport: Input channel constructed: fd=71
10-03 22:40:54.178 29058-29058/com.destudios.tmedias V/InputMethodManager: Starting input: tba=android.view.inputmethod.EditorInfo@3141f4 nm : com.destudios.tmedias ic=com.android.internal.widget.EditableInputConnection@dc99d1d
10-03 22:40:54.231 29058-29058/com.destudios.tmedias D/ViewRootImpl@f360f04[LoginActivity]: MSG_WINDOW_FOCUS_CHANGED 0
10-03 22:40:54.233 29058-29058/com.destudios.tmedias D/SEM_CLIP_SemClipboardManager: isCocktailBarDisplayed : false
10-03 22:40:54.235 29058-29058/com.destudios.tmedias D/SEM_CLIP_SemClipboardManager: isCocktailBarDisplayed : false
10-03 22:40:54.587 29058-29058/com.destudios.tmedias D/ViewRootImpl@f360f04[LoginActivity]: MSG_WINDOW_FOCUS_CHANGED 1
10-03 22:40:54.587 29058-29058/com.destudios.tmedias D/ViewRootImpl@f360f04[LoginActivity]: mHardwareRenderer.initializeIfNeeded()#2 mSurface={isValid=true 486657081856}
10-03 22:40:54.594 29058-29058/com.destudios.tmedias D/SEM_CLIP_SemClipboardManager: isCocktailBarDisplayed : false
10-03 22:40:54.598 29058-29058/com.destudios.tmedias D/SEM_CLIP_SemClipboardManager: isCocktailBarDisplayed : false
10-03 22:40:54.701 29058-29058/com.destudios.tmedias D/ViewRootImpl@f360f04[LoginActivity]: Relayout returned: oldFrame=[0,0][1440,2560] newFrame=[0,0][1440,2560] result=0x1 surface={isValid=true 486657081856} surfaceGenerationChanged=false
10-03 22:40:55.031 29058-29058/com.destudios.tmedias D/ViewRootImpl@f360f04[LoginActivity]: The input has been finished in ImeInputStage.
10-03 22:40:55.139 29058-29058/com.destudios.tmedias D/ViewRootImpl@f360f04[LoginActivity]: The input has been finished in ImeInputStage.
10-03 22:40:55.181 29058-29058/com.destudios.tmedias D/ViewRootImpl@f360f04[LoginActivity]: MSG_RESIZED: ci=Rect(0, 96 - 0, 0) vi=Rect(0, 96 - 0, 0) or=1
10-03 22:40:55.210 29058-29058/com.destudios.tmedias D/ViewRootImpl@f360f04[LoginActivity]: Relayout returned: oldFrame=[0,0][1440,2560] newFrame=[0,0][1440,2560] result=0x1 surface={isValid=true 486657081856} surfaceGenerationChanged=false
10-03 22:40:55.229 29058-29058/com.destudios.tmedias D/ScrollView:  onsize change changed 
10-03 22:40:55.787 29058-29058/com.destudios.tmedias D/ViewRootImpl@f360f04[LoginActivity]: ViewPostImeInputStage processPointer 0
10-03 22:40:55.792 29058-29058/com.destudios.tmedias W/System: ClassLoader referenced unknown path: /system/framework/QPerformance.jar
10-03 22:40:55.794 29058-29058/com.destudios.tmedias E/BoostFramework: BoostFramework() : Exception_1 = java.lang.ClassNotFoundException: Didn't find class "com.qualcomm.qti.Performance" on path: DexPathList[[],nativeLibraryDirectories=[/system/lib64, /vendor/lib64]]
10-03 22:40:55.795 29058-29058/com.destudios.tmedias V/BoostFramework: BoostFramework() : mPerf = null
10-03 22:40:55.859 29058-29058/com.destudios.tmedias D/ViewRootImpl@f360f04[LoginActivity]: ViewPostImeInputStage processPointer 1
10-03 22:40:55.901 29058-29058/com.destudios.tmedias D/TextView: setTypeface with style : 0
10-03 22:40:55.916 29058-29058/com.destudios.tmedias D/TextView: setTypeface with style : 0
10-03 22:40:55.923 29058-29058/com.destudios.tmedias D/TextView: setTypeface with style : 0
10-03 22:40:55.925 29058-29058/com.destudios.tmedias D/TextView: setTypeface with style : 0
10-03 22:40:55.926 29058-29058/com.destudios.tmedias D/TextView: setTypeface with style : 0
10-03 22:40:55.933 29058-29058/com.destudios.tmedias D/ViewRootImpl@4efc231[Portal CEFSA]: ThreadedRenderer.create() translucent=true
10-03 22:40:55.939 29058-29058/com.destudios.tmedias D/InputTransport: Input channel constructed: fd=72
10-03 22:40:55.940 29058-29058/com.destudios.tmedias D/ViewRootImpl@4efc231[Portal CEFSA]: setView = DecorView@a26cd16[Portal CEFSA] touchMode=true
10-03 22:40:55.944 29058-29058/com.destudios.tmedias D/ViewRootImpl@4efc231[Portal CEFSA]: dispatchAttachedToWindow
10-03 22:40:55.956 29058-30069/com.destudios.tmedias D/NetworkSecurityConfig: No Network Security Config specified, using platform default
10-03 22:40:55.959 29058-30069/com.destudios.tmedias I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
10-03 22:40:55.959 29058-30069/com.destudios.tmedias I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
10-03 22:40:55.968 29058-29058/com.destudios.tmedias D/ViewRootImpl@4efc231[Portal CEFSA]: Relayout returned: oldFrame=[0,0][0,0] newFrame=[36,1006][1404,1649] result=0x27 surface={isValid=true 486657074688} surfaceGenerationChanged=true
10-03 22:40:55.968 29058-29058/com.destudios.tmedias D/ViewRootImpl@4efc231[Portal CEFSA]: mHardwareRenderer.initialize() mSurface={isValid=true 486657074688} hwInitialized=true
10-03 22:40:55.971 29058-29105/com.destudios.tmedias D/mali_winsys: EGLint new_window_surface(egl_winsys_display*, void*, EGLSurface, EGLConfig, egl_winsys_surface**, egl_color_buffer_format*, EGLBoolean) returns 0x3000,  [1624x899]-format:1
10-03 22:40:55.981 29058-29058/com.destudios.tmedias D/ViewRootImpl@4efc231[Portal CEFSA]: MSG_WINDOW_FOCUS_CHANGED 1
10-03 22:40:55.981 29058-29058/com.destudios.tmedias D/ViewRootImpl@4efc231[Portal CEFSA]: mHardwareRenderer.initializeIfNeeded()#2 mSurface={isValid=true 486657074688}
10-03 22:40:56.023 29058-29058/com.destudios.tmedias D/ViewRootImpl@4efc231[Portal CEFSA]: MSG_RESIZED_REPORT: ci=Rect(0, 0 - 0, 0) vi=Rect(0, 0 - 0, 0) or=1
10-03 22:40:56.053 29058-29058/com.destudios.tmedias D/ViewRootImpl@f360f04[LoginActivity]: MSG_WINDOW_FOCUS_CHANGED 0
10-03 22:40:56.055 29058-29058/com.destudios.tmedias D/SEM_CLIP_SemClipboardManager: isCocktailBarDisplayed : false
10-03 22:40:56.056 29058-29058/com.destudios.tmedias D/SEM_CLIP_SemClipboardManager: isCocktailBarDisplayed : false
10-03 22:40:56.131 29058-30069/com.destudios.tmedias I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
10-03 22:40:56.131 29058-30069/com.destudios.tmedias I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
10-03 22:40:56.276 29058-30069/com.destudios.tmedias W/System.err: org.jsoup.HttpStatusException: HTTP error fetching URL. Status=500, URL=http://aluno.cefsa.edu.br/Login/Login
10-03 22:40:56.279 29058-30069/com.destudios.tmedias W/System.err:     at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:679)
10-03 22:40:56.279 29058-30069/com.destudios.tmedias W/System.err:     at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:628)
10-03 22:40:56.279 29058-30069/com.destudios.tmedias W/System.err:     at org.jsoup.helper.HttpConnection.execute(HttpConnection.java:260)
10-03 22:40:56.280 29058-30069/com.destudios.tmedias W/System.err:     at com.destudios.tmedias.LoginActivity$Title.doInBackground(LoginActivity.java:74)
10-03 22:40:56.280 29058-30069/com.destudios.tmedias W/System.err:     at com.destudios.tmedias.LoginActivity$Title.doInBackground(LoginActivity.java:35)
10-03 22:40:56.280 29058-30069/com.destudios.tmedias W/System.err:     at android.os.AsyncTask$2.call(AsyncTask.java:304)
10-03 22:40:56.280 29058-30069/com.destudios.tmedias W/System.err:     at java.util.concurrent.FutureTask.run(FutureTask.java:237)
10-03 22:40:56.280 29058-30069/com.destudios.tmedias W/System.err:     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
10-03 22:40:56.280 29058-30069/com.destudios.tmedias W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
10-03 22:40:56.280 29058-30069/com.destudios.tmedias W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
10-03 22:40:56.280 29058-30069/com.destudios.tmedias W/System.err:     at java.lang.Thread.run(Thread.java:762)
10-03 22:40:56.321 29058-29058/com.destudios.tmedias D/ViewRootImpl@4efc231[Portal CEFSA]: mHardwareRenderer.destroy()#4
10-03 22:40:56.321 29058-29058/com.destudios.tmedias D/ViewRootImpl@4efc231[Portal CEFSA]: dispatchDetachedFromWindow
10-03 22:40:56.337 29058-29058/com.destudios.tmedias D/InputTransport: Input channel destroyed: fd=72
10-03 22:40:56.344 29058-29058/com.destudios.tmedias D/ViewRootImpl@f360f04[LoginActivity]: MSG_WINDOW_FOCUS_CHANGED 1
10-03 22:40:56.344 29058-29058/com.destudios.tmedias D/ViewRootImpl@f360f04[LoginActivity]: mHardwareRenderer.initializeIfNeeded()#2 mSurface={isValid=true 486657081856}
10-03 22:40:56.349 29058-29058/com.destudios.tmedias D/SEM_CLIP_SemClipboardManager: isCocktailBarDisplayed : false
10-03 22:40:56.350 29058-29058/com.destudios.tmedias D/SEM_CLIP_SemClipboardManager: isCocktailBarDisplayed : false
10-03 22:40:56.354 29058-29058/com.destudios.tmedias E/ViewRootImpl: sendUserActionEvent() mView == null
10-03 22:41:25.564 29058-29058/com.destudios.tmedias D/ViewRootImpl@f360f04[LoginActivity]: MSG_WINDOW_FOCUS_CHANGED 0
10-03 22:41:25.570 29058-29058/com.destudios.tmedias D/SEM_CLIP_SemClipboardManager: isCocktailBarDisplayed : false
10-03 22:41:25.572 29058-29058/com.destudios.tmedias D/SEM_CLIP_SemClipboardManager: isCocktailBarDisplayed : false
10-03 22:41:25.668 29058-29058/com.destudios.tmedias D/ViewRootImpl@f360f04[LoginActivity]: mHardwareRenderer.destroy()#1
10-03 22:41:25.689 29058-29058/com.destudios.tmedias D/ViewRootImpl@f360f04[LoginActivity]: Relayout returned: oldFrame=[0,0][1440,2560] newFrame=[0,0][1440,2560] result=0x5 surface={isValid=false 0} surfaceGenerationChanged=true
10-03 22:41:25.828 29058-29058/com.destudios.tmedias D/InputTransport: Input channel destroyed: fd=71
10-03 22:41:25.832 29058-29058/com.destudios.tmedias W/IInputConnectionWrapper: reportFullscreenMode on inexistent InputConnection
10-03 22:41:25.834 29058-29058/com.destudios.tmedias W/IInputConnectionWrapper: finishComposingText on inactive InputConnection
10-03 22:41:26.048 29058-29058/com.destudios.tmedias D/ViewRootImpl@f360f04[LoginActivity]: mHardwareRenderer.destroy()#1
10-03 22:41:26.062 29058-29058/com.destudios.tmedias D/ViewRootImpl@f360f04[LoginActivity]: Relayout returned: oldFrame=[0,0][1440,2560] newFrame=[0,0][1440,2560] result=0x1 surface={isValid=false 0} surfaceGenerationChanged=false

XML

<ScrollView xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">

<android.support.constraint.ConstraintLayout
android:background="@android:color/white"
tools:context="com.destudios.tmedias.LoginActivity"
android:layout_width="match_parent"
android:layout_height="match_parent">
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="81dp">

<ImageView
    android:id="@+id/img_logo"
    android:layout_width="95dp"
    android:layout_height="73dp"
    android:contentDescription="@string/logo_description"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintHorizontal_bias="0.501"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="@+id/guideline"
    app:srcCompat="@mipmap/ic_launcher_round" />

<AutoCompleteTextView
    android:id="@+id/txt_ra"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_marginTop="32dp"
    android:inputType="number"
    app:layout_constraintEnd_toStartOf="@+id/guideline3"
    app:layout_constraintStart_toStartOf="@+id/txt_senha"
    app:layout_constraintTop_toBottomOf="@+id/img_logo" />

<TextView
    android:id="@+id/textView"
    android:layout_width="wrap_content"
    android:layout_height="25dp"
    android:layout_marginStart="8dp"
    android:paddingRight="5dp"
    android:text="RA:"
    android:textColor="@android:color/black"
    android:textSize="18sp"
    app:layout_constraintBaseline_toBaselineOf="@+id/txt_ra"
    app:layout_constraintEnd_toStartOf="@+id/txt_senha"
    app:layout_constraintStart_toStartOf="@+id/textView2"
    android:layout_marginLeft="8dp" />

<TextView
    android:id="@+id/textView2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginStart="8dp"
    android:paddingRight="5dp"
    android:text="Senha:"
    android:textColor="@android:color/black"
    android:textSize="18sp"
    app:layout_constraintBaseline_toBaselineOf="@+id/txt_senha"
    app:layout_constraintStart_toStartOf="@+id/guideline2"
    android:layout_marginLeft="8dp" />

<EditText
    android:id="@+id/txt_senha"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_marginTop="32dp"
    android:ems="10"
    android:inputType="textPassword"
    app:layout_constraintEnd_toStartOf="@+id/guideline3"
    app:layout_constraintStart_toEndOf="@+id/textView2"
    app:layout_constraintTop_toBottomOf="@+id/txt_ra" />

<Button
    android:id="@+id/btn_login"
    style="@style/Widget.AppCompat.Button.Colored"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="50dp"
    android:text="Login"
    android:textColor="@android:color/black"
    app:layout_constraintEnd_toStartOf="@+id/guideline3"
    app:layout_constraintHorizontal_bias="0.5"
    app:layout_constraintStart_toEndOf="@+id/guideline2"
    app:layout_constraintTop_toBottomOf="@+id/txt_senha" />

<android.support.constraint.Guideline
    android:id="@+id/guideline"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    app:layout_constraintGuide_percent="0.1" />

<android.support.constraint.Guideline
    android:id="@+id/guideline2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    app:layout_constraintGuide_percent="0.04" />

<android.support.constraint.Guideline
    android:id="@+id/guideline3"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    app:layout_constraintGuide_percent="0.9609375" />

<TextView
    android:id="@+id/txt_teste"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_marginBottom="8dp"
    android:layout_marginEnd="8dp"
    android:layout_marginStart="8dp"
    android:layout_marginTop="24dp"
    android:text="TextView"
    android:textColor="@android:color/black"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toStartOf="@+id/guideline3"
    app:layout_constraintHorizontal_bias="0.0"
    app:layout_constraintStart_toStartOf="@+id/guideline2"
    app:layout_constraintTop_toBottomOf="@+id/btn_login" />

</android.support.constraint.ConstraintLayout>

</ScrollView>

Program

public class LoginActivity extends AppCompatActivity {
    ProgressDialog mProgressDialog;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
        Button btn_login = (Button) findViewById(R.id.btn_login);

        btn_login.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                new Title().execute();
            }
        });
    }

    private class Title extends AsyncTask<Void, Void, Void>
    {
        String title;
        @Override
        protected void onPreExecute() {
            super.onPreExecute();
            mProgressDialog = new ProgressDialog(LoginActivity.this);
            mProgressDialog.setTitle("Portal CEFSA");
            mProgressDialog.setMessage("Loading...");
            mProgressDialog.setIndeterminate(false);
            mProgressDialog.show();
        }

        @Override
        protected Void doInBackground(Void... params) {

            org.jsoup.Connection.Response res = null;
            try {
                res = Jsoup.connect("http://aluno.cefsa.edu.br/Login")
                        .followRedirects(true)
                        .method(org.jsoup.Connection.Method.GET)
                        .execute();


            TextView txt_senha = (TextView) findViewById(R.id.txt_senha);
                TextView txt_ra = (TextView) findViewById(R.id.txt_ra);


                String usuario = txt_ra.toString();
                String senha = txt_senha.toString();

                org.jsoup.Connection.Response formLogin = Jsoup.connect("http://aluno.cefsa.edu.br/Login/Login")
                        .followRedirects(true)
                        .referrer("http://aluno.cefsa.edu.br/Login/Login")
                        .cookies(res.cookies())
                        .method(org.jsoup.Connection.Method.POST)
                        .data("Usuario", usuario)
                        .data("Senha", senha)
                        .data("go", "")
                        .execute();

            Map<String, String> cookies = formLogin.cookies();

            Document homePage = Jsoup.connect("http://aluno.cefsa.edu.br/Home")
                    .cookies(cookies)
                    .get();

                title = homePage.body().html();

            } catch (IOException e) {
                e.printStackTrace();
                title = "ERRO";
            }
            return null;
        }
        @Override
        protected void onPostExecute(Void result) {
            // Set title into TextView
            TextView txt_teste = (TextView) findViewById(R.id.txt_teste);
            if (title != null)
                txt_teste.setText(title);
            //else
            //    txt_teste.setText("ERRO");
            mProgressDialog.dismiss();
        }
    }
}

Manifest

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.destudios.tmedias">
    //Permissão para usar internet
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".LoginActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>
Fabio C.
  • 3
  • 2
  • can you try Jsoup.connect("http://aluno.cefsa.edu.br/Login") and .referrer("http://aluno.cefsa.edu.br/Home") instead of .referrer("http://aluno.cefsa.edu.br/Login/Login") – Dev Oct 04 '17 at 03:50
  • https://stackoverflow.com/questions/21858701/how-to-fix-http-error-fetching-url-status-500-in-java-while-crawling check if this helps – Abhijit Chakra Oct 04 '17 at 03:56
  • Does not work like that – Fabio C. Oct 04 '17 at 22:36

0 Answers0