/    Sign up×
Community /Pin to ProfileBookmark

Getting results from API

I’m looking for some help in using an API – I know my HTML, PHP, and some javascript – but I’ll admit that I’m brand new to API’s.

I want a code that returns the results of [URL=”http://tinyurl.com/api-create.php?url=http://feeds.feedburner.com/~r/Diggfeedr/~3/240485152/1337″]this[/URL] page.

Something like this:

[CODE]function tinyconvert(url) {
newurl = some_function_i_don’t_know(‘http://tinyurl.com/api-create.php?url=’ + url);
return newurl;
}[/CODE]

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@parterburnauthorMar 01.2008 — I'm still trying to find a solution for all this...and found a site that might help:

http://remysharp.com/tinyurlapi

I'm still no resident expert in Javascript so would really like some help in deciphering the code Remy presents:
[CODE]
<script type="text/javascript" charset="utf-8">
window.onload = function() {
var s = document.createElement('script');
var v = document.getElementById('url').value;
s.setAttribute('src', 'http://remysharp.com/tinyurlapi?callback=tinyurlCallback&url=' + v);
document.body.appendChild(s);
}

function tinyurlCallback(url) {
alert('URL converted to: ' + url);
}
</script>[/CODE]


Is there anyway of turning this into one function so that I can call it & send a URL to it and it returns the tinyurl? I'm using it in a Greasemonkey script, so the above code doesn't work for me.
×

Success!

Help @parterburn spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.6,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...