Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why isnt this PostAsync() posting on pastebin?

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

✓ Accepted answer

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)

8 comments

1

So your local API Would be my API? Or my paste?

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.

0

Oh.. kk Thank's diitto! ;D

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!

0

Maybe you got -24 :(

0

I looked at my rep and I didnt get a -24. :/ Must be a website coding error.

0

Diitto is there a way to use PostAsync on stypi? :3

0

Nope.

This discussion is preserved as it was. New answers, comments, and votes are closed.