hi i m new to create extension so please help me.
today i create a extension to read content from url .my extension create successfully. my function is
@SimpleFunction(description = "Simple url content reader")
public static String getText(String url) throws Exception
{
URL website = new URL(url);
URLConnection connection = website.openConnection();
BufferedReader in = new BufferedReader(
new InputStreamReader(
connection.getInputStream()));
StringBuilder response = new StringBuilder();
String inputLine;
while ((inputLine = in.readLine()) != null)
response.append(inputLine);
in.close();
return response.toString();
}
First You should learn the java then make extension.
The runtime error is showing because you code is wrong. You have to use a thread for fetching data from the URL. If you don’t know about thread then you can google it and there are many open source extension that fetches the data from URL. You must take a look to them.
Let have a look to this extension 's sources
It has used thread for getting the data from URL.
I hope it will help you.
Really??
You still requesting for the code even I have shared the source of my extension with you.
I do not know why everyone wants the complete code nowadays. Why don’t you guys want to work hard if you always ask for the readymade code then you will never learn anything.
What’s the problem in the extension’s sources code. It is also a extension. Try that if you are facing any issue then post here… We are ready to help you but you must try yourself first before asking for a readymade code.