Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Why isnt this PostAsync() posting on pastebin?

Asked by 10 years ago

I have no error in output. Any problem's?

local Link = 'http://pastebin.com/maN3f8pW'

local http = game.HttpService

local data={
    'm=Instance.new("Message",game.workspace) 
    m.Text="PASTEBIN! 
    wait(15) 
    m:remove()'
}

function a()
    data=http:JSONEncode(data)
    http:PostAsync(Link,data)
    wait()
    print(data)
end


while true do
wait(5) 
a()
end 

1 answer

Log in to vote
1
Answered by
Diitto 230 Moderation Voter
10 years ago

Jill, did you review the Pastebin API? Posting to Pastebin requires an application/x-www-form-urlencoded POST format.

My little Pastebin API I made a while ago:


local API='http://www.pastebin.com/api/api_post.php'; local HTTPService=game:service'HttpService'; local strf=string.format; function pastebin_get(paste_id) return HTTPService:getAsync( strf('http://www.pastebin.com/raw.php?i=%s',tostring(paste_id)), true ); end; function pastebin_post(dev_key,user_key,paste_name,paste_code) local Data={ 'api_option=paste'; strf('api_user_key=%s',tostring(user_key)); 'api_paste_private=1'; strf('api_paste_name=%s',HTTPService:UrlEncode( tostring(paste_name or 'Misc')) ); 'api_paste_expire_data=N'; 'api_paste_format=lua'; strf('api_dev_key=%s',tostring(dev_key)); strf('api_paste_code=%s',HTTPService:UrlEncode( tostring(paste_code)) ); }; Data=table.concat(Data,'&'); local Result=HTTPService:postAsync(API,Data,2); print('Results: '..Result); return(Result); end;

The dev_key is your developer key on Pastebin. Note, this may not work, for I just fixed it.(I don't use it, I have my own site to hold data)

1
So your local API Would be my API? Or my paste? MessorAdmin 598 — 10y
0
Um, no. The API would be the Pastebin API PHP script page. :L Read the API article on Pastebin, please. It is not possible to edit a paste, though you can get it's contents, delete it, and repost it with the new data. Diitto 230 — 10y
0
Oh.. kk Thank's diitto! ;D MessorAdmin 598 — 10y
0
I have no idea why my stats reset. I guess a website script error? It was at 22 and when I loged back on after 2 days it was -2! MessorAdmin 598 — 10y
View all comments (4 more)
0
Maybe you got -24 :( Diitto 230 — 10y
0
I looked at my rep and I didnt get a -24. :/ Must be a website coding error. MessorAdmin 598 — 10y
0
Diitto is there a way to use PostAsync on stypi? :3 MessorAdmin 598 — 10y
0
Nope. Diitto 230 — 10y
Ad

Answer this question