XWidgetSoft Forum

XWidget & XLaunchpad , Desktop customization
It is currently May 10th, 2025, 12:10 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: is.gd api
PostPosted: May 23rd, 2013, 3:52 am 
Offline

Joined: March 14th, 2013, 5:49 am
Posts: 52
is.gd api how to use the widget?
http://is.gd/
create.php?format=simple&url=www.example.com


Top
 Profile  
 
 Post subject: Re: is.gd api
PostPosted: May 25th, 2013, 10:44 pm 
Offline

Joined: March 14th, 2013, 5:49 am
Posts: 52
I found a way, he is quite fine with me, but terribly widget hangs.
how to make a thread?

Code:
function timercore1OnUpdate(Sender)
{
     function file_get_contents( url ) {   // Reads entire file into a string
   //
   // +   original by: Legaev Andrey
   // %      note 1: This function uses XmlHttpRequest and cannot retrieve resource from different domain.

   var req = null;
   try { req = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {
      try { req = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {
         try { req = new XMLHttpRequest(); } catch(e) {}
      }
   }
   if (req == null) throw new Error('XMLHttpRequest not supported');

   req.open("GET", url, false);
   req.send(null);

   return req.responseText;
}
var echo = file_get_contents('http://is.gd/create.php?format=simple&url=www.example.com');
alert(echo);
}


Top
 Profile  
 
 Post subject: Re: is.gd api
PostPosted: May 25th, 2013, 11:34 pm 
Offline
User avatar

Joined: March 8th, 2013, 10:27 pm
Posts: 353
modify your code a bit!
Code:
req.open("GET",url,true);
req.onreadystatechange=function() {
  if (req.readyState==4) {
   var response = req.responseText; //do something

 }
 }
req.send(null);

This is better than GetHttpStrAsync

Note: the code above DOESN'T HAVE ANY RESTRICTIONS! Ignore the warning in your code. That's only for websites.

_________________
Life is a myriad game... Just play it!


Top
 Profile  
 
 Post subject: Re: is.gd api
PostPosted: May 26th, 2013, 12:01 am 
Offline

Joined: March 14th, 2013, 5:49 am
Posts: 52
I can not ... can you please throw example


Top
 Profile  
 
 Post subject: Re: is.gd api
PostPosted: May 27th, 2013, 3:45 pm 
Offline

Joined: March 14th, 2013, 5:49 am
Posts: 52
up.............


Top
 Profile  
 
 Post subject: Re: is.gd api
PostPosted: May 28th, 2013, 7:18 pm 
Offline
User avatar

Joined: March 8th, 2013, 10:27 pm
Posts: 353
I had given one, modify your code a bit
Code:

function timercore1OnUpdate(Sender)
{
     function file_get_contents_async( url ,callback) {   // Reads entire file into a string
   //
   // +   original by: Legaev Andrey
   var req = null;
   try { req = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {
      try { req = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {
         try { req = new XMLHttpRequest(); } catch(e) {}
      }
   }
   if (req == null) throw new Error('XMLHttpRequest not supported');

req.open("GET",url,true);
req.onreadystatechange=callback;
req.send(null);
}

file_get_contents_async('http://is.gd/create.php?format=simple&url=www.example.com',function() {
  if (req.readyState==4) {
   var response = req.responseText; //do something
   alert(response);
 });
}

_________________
Life is a myriad game... Just play it!


Top
 Profile  
 
 Post subject: Re: is.gd api
PostPosted: May 28th, 2013, 9:31 pm 
Offline

Joined: March 14th, 2013, 5:49 am
Posts: 52
Knocks out a syntax error.


Attachments:
Untitled2.XWidgetPkg [6.65 KiB]
Downloaded 309 times
Top
 Profile  
 
 Post subject: Re: is.gd api
PostPosted: May 28th, 2013, 10:17 pm 
Offline

Joined: March 14th, 2013, 5:49 am
Posts: 52
[09:13:59 629]: [Script Error (line:23,char:3) ]

Nothing comes of not getting an answer ... alert function does not work


Top
 Profile  
 
 Post subject: Re: is.gd api
PostPosted: May 28th, 2013, 10:18 pm 
Offline

Joined: March 14th, 2013, 5:49 am
Posts: 52
Syntax Error ...


Top
 Profile  
 
 Post subject: Re: is.gd api
PostPosted: May 29th, 2013, 6:32 pm 
Offline
User avatar

Joined: March 8th, 2013, 10:27 pm
Posts: 353
Oh! you could correct that, a simple bracket was missing...
Ok ok, I've streamlined the methods... you can now reuse with simple copy paste...

Grab the modified widget
Attachment:
Untitled2.XWidgetPkg [6.66 KiB]
Downloaded 310 times

_________________
Life is a myriad game... Just play it!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 39 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB® Forum Software © phpBB Group