2088 posts
Location
South Africa
Posted 08 February 2013 - 09:50 AM
Hey, I'm trying to do what Cranium did with his smartpost:
local response = http.post(
"http://pastebin.com/api/api_login.php",
"api_dev_key="..key.."&"..
"api_user_name="..textutils.urlEncode(user).."&"..
"api_user_password="..textutils.urlEncode(pass)
)
I'm trying to figure out how to use it for a form for my new CC YouTube program.
This is the website I'll be posting to:
http://cc-youtube.hostei.com/add-info.phpOf course, if I can, I'll remove the simple math question ,_,
But is this possible?
1054 posts
Posted 08 February 2013 - 10:18 AM
Hey, I'm trying to do what Cranium did with his smartpost:
local response = http.post(
"http://pastebin.com/api/api_login.php",
"api_dev_key="..key.."&"..
"api_user_name="..textutils.urlEncode(user).."&"..
"api_user_password="..textutils.urlEncode(pass)
)
I'm trying to figure out how to use it for a form for my new CC YouTube program.
This is the website I'll be posting to:
Of course, if I can, I'll remove the simple math question ,_,
But is this possible?
Yes, it's perfectly possible. But which site is it exactly, I don't see it there? (copy paste mistake? :P/>)
2088 posts
Location
South Africa
Posted 08 February 2013 - 10:23 AM
Hmm, well that's quite dumb of me xD
Added link in first post
1054 posts
Posted 08 February 2013 - 10:52 AM
I looked into it and I came up with this:
local username = "remiX"
local title = "video title"
local url = "http://pastebin.com/ABCDEF"
local description = "video description"
local answer = "42" -- the answer to the user question
local params = string.format("username=%s&video_title=%s&video_url=%s&description=%s&user_answer=%s&answer=%s&contact_submitted=send", username, title, textutils.urlEncode(url), description, answer, answer)
local res = http.post("http://cc-youtube.hostei.com/add-info.php", params) -- or use http.request if you want to know the success state
I can't test this yet, I have little time. But aside for an eventual typo or stupid syntax mistake, I'm quite sure that this will work.
2088 posts
Location
South Africa
Posted 08 February 2013 - 06:20 PM
Wow, thanks. It worked :P/>