Advertisement
Guest User

ROTM_Shortener

a guest
Jan 17th, 2018
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  2. Dim wb As New Net.WebClient
  3.  
  4. Dim url As String = "&url=" & Uri.EscapeDataString(TextBox1.Text)
  5.  
  6. Dim rsp As String
  7. Try
  8. rsp = wb.DownloadString("https://is.gd/create.php?format=json" & url & "&shorturl=" & TextBox3.Text & "&logstats=1") 'خاصية أختيارية ليتمكن المستخدم من لرؤية احصائيات الرابط logstats يمكن جعل
  9. Catch ex As Exception
  10. MsgBox(ex.Message, vbCritical, "")
  11. Exit Sub
  12. End Try
  13.  
  14. Dim urli As SByte = rsp.IndexOf("http")
  15.  
  16. If urli < 0 Then
  17. Dim errcode As Byte = rsp.Substring(rsp.IndexOf(":") + 2, 1)
  18. If errcode = 1 Then
  19. MsgBox("أكتب الرابط بشكل صحيح")
  20. ElseIf errcode = 2 Then
  21. MsgBox("الرابط موجود مسبقا")
  22. ElseIf errcode = 3 Then
  23. MsgBox("تخطيت العدد المسموح حاول لاحقآ")
  24. Else
  25. MsgBox("خطا في الخدمة")
  26. End If
  27. Exit Sub
  28. Else
  29. rsp = rsp.Substring(urli, rsp.LastIndexOf("""") - urli)
  30. End If
  31.  
  32. TextBox2.Text = rsp
  33.  
  34. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement