-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPingOMatic.java
More file actions
65 lines (56 loc) · 2.15 KB
/
Copy pathPingOMatic.java
File metadata and controls
65 lines (56 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.util.ArrayList;
import org.apache.http.client.utils.URIUtils;
public class PingOMatic {
/**
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
String sitesParameters = "&chk_weblogscom=on&chk_blogs=on&chk_feedburner=on&chk_newsgator=on&chk_myyahoo=on&chk_pubsubcom=on&chk_blogdigger=on&chk_weblogalot=on&chk_newsisfree=on&chk_topicexchange=on&chk_google=on&chk_tailrank=on&chk_skygrid=on&chk_collecta=on&chk_superfeedr=on&chk_audioweblogs=on&chk_rubhub=on&chk_a2b=on&chk_blogshares=on";
File file = new File(
("E:/IC_Dropbox/Dropbox/MeetAV/SEO/FO82AD2B4EA1/not yet pinged.txt"));
BufferedReader in = new BufferedReader(new FileReader(file));
int counter = 0;
File fileKeywords = new File(
"E:/IC_Dropbox/Dropbox/MeetAV/SEO/keywords.txt");
BufferedReader keyword_in = new BufferedReader(new FileReader(fileKeywords));
ArrayList<String> keywords = new ArrayList<String>();
while (keyword_in.ready()) {
String s = keyword_in.readLine();
keywords.add(s);
}
int keyword_counter = 0;
int total_keywords = keywords.size();
while (in.ready() && counter < 100) {
String s = URLEncoder.encode(in.readLine());
String title = URLEncoder.encode(keywords.get(keyword_counter));
keyword_counter++;
if (keyword_counter == total_keywords) {
keyword_counter = 0;
}
String url = "http://pingomatic.com/ping/?" + "title=" + title
+ "&blogurl=" + s + "&rssurl=http%3A%2F%2F"+sitesParameters;
System.out.println(url);
URL pingometic = new url(url);
URLConnection connection = pingometic.openConnection();
DataInputStream dis = new DataInputStream(
connection.getInputStream());
String inputLine;
while ((inputLine = dis.readLine()) != null) {
System.out.println(inputLine);
}
dis.close();
counter++;
}
in.close();
}
}