Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
SC1 - ID lookup tool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
am13g23
SC1 - ID lookup tool
Commits
0fd9a495
Commit
0fd9a495
authored
1 year ago
by
am13g23
Browse files
Options
Downloads
Patches
Plain Diff
Uploaded source code
parent
79a68d19
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
SotonLookupTool.java
+51
-0
51 additions, 0 deletions
SotonLookupTool.java
with
51 additions
and
0 deletions
SotonLookupTool.java
0 → 100644
+
51
−
0
View file @
0fd9a495
import
java.io.BufferedReader
;
import
java.io.InputStreamReader
;
import
java.net.URL
;
import
java.net.HttpURLConnection
;
class
SotonLookupTool
{
public
static
String
ReadLine
(
String
message
){
BufferedReader
br
=
new
BufferedReader
(
new
InputStreamReader
(
System
.
in
));
System
.
out
.
print
(
message
);
try
{
return
br
.
readLine
();
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
e
);
return
""
;
}
}
public
static
String
MakeHttpGetRequest
(
String
URL
){
return
""
;
}
public
static
void
main
(
String
[]
args
){
try
{
String
id
=
ReadLine
(
"Enter id: "
);
URL
url
=
new
URL
(
"https://www.ecs.soton.ac.uk/people/"
+
id
);
HttpURLConnection
connection
=
(
HttpURLConnection
)
url
.
openConnection
();
connection
.
setRequestMethod
(
"GET"
);
BufferedReader
br
=
new
BufferedReader
(
new
InputStreamReader
(
connection
.
getInputStream
()));
String
line
;
boolean
found
=
false
;
do
{
line
=
br
.
readLine
();
if
(
line
!=
null
){
if
(
line
.
length
()
>=
25
){
//System.out.println(line.substring(0,25));
if
(
line
.
substring
(
0
,
25
).
equals
(
"<meta property=\"og:title\""
)){
System
.
out
.
print
(
"Found: "
);
System
.
out
.
println
(
line
.
substring
(
35
,(
line
.
length
()-
4
)));
}
}
}
}
while
(
line
!=
null
);
if
(!
found
){
System
.
out
.
println
(
"Not found"
);
}
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
e
);
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment