95 posts
Location
Somewhere near the local computer store?
Posted 05 January 2013 - 04:34 PM
Hey guys, can anyone help me with something? I need someone to write a php script for me! WARNING: I'm completely dumb when it comes to php!
Requirments of the scipt:
- When I type the url it needs to take a paramater ( so heres what that would look like:
www.mysite.com/files/script.php&filepath="ThePathToFile" )
- If the given path doesn't exist then it needs to pretend like it doesn't respond ( So when I call http.request(blahblah) it will return the event "http_failure" if the file doesn't exist
- The php script needs to take the information from the file (The text inside a file) and display it as a raw text format, kinda like what pastebin does
- It needs to be restricted to looking in one dir (so it would be the equivalent of fs.exists("TheBaseDirForLooking/"..filename) but thats in lua)
- Doesn't need any security features as long as its restricted to the one directory
Thanks guys, can anyone do this for me? I don't think it should be too hard. If you want hook up with me on skype to talk about it! (Just PM me for my skype)
8543 posts
Posted 05 January 2013 - 05:39 PM
Try over in General. Moved.
25 posts
Posted 05 January 2013 - 05:47 PM
Will do it tomorrow as soon as I wake up, I'll edit this post not to spam
1619 posts
Posted 05 January 2013 - 05:48 PM
Good luck getting help here. You'll probably have more luck on a PHP forum.
95 posts
Location
Somewhere near the local computer store?
Posted 05 January 2013 - 05:59 PM
Alright, thank you so much Aichan!
DLCruze: Where are some good forums
180 posts
Posted 05 January 2013 - 06:03 PM
Good luck getting help here. You'll probably have more luck on a PHP forum.
I'd offer, but don't think he would want to pay my going rates ;}
A file upload over http post is not quite as simple as is stated above…
I just last week finished setting up a HasteBin server and writing a CC client to use it. No more pastebin expirations, yeay!
1619 posts
Posted 05 January 2013 - 06:15 PM
Alright, thank you so much Aichan!
DLCruze: Where are some good forums
http://lmgtfy.com/?q=PHP+forums
25 posts
Posted 05 January 2013 - 06:16 PM
147 posts
Location
England
Posted 05 January 2013 - 11:33 PM
You can echo a string to the site like
If(!fileexists){
echo "File not found";
}
Lua
If requestdata == "File not found" or http_failure then
--do your stuff
End
The file stuff is pretty simple, read the file line by line in Lua. Send the file data in a request and append a splitter character such as "|" or "&split&" something that would never be used. You can then split the post data into an array using PHPs explode function. And then loop through it and do what you want with the data. I don't think computer craft has the ability to properly send files over http, this is a good alternative.
537 posts
Location
Copenhagen, Denmark
Posted 06 January 2013 - 01:40 AM
This is like the simplest thing ever.
797 posts
Posted 06 January 2013 - 01:52 AM
in php…how do you return something to a pc in minecraft? can you use echo to return something?
799 posts
Location
Land of Meh
Posted 06 January 2013 - 02:16 AM
Alright, thank you so much Aichan!
DLCruze: Where are some good forums
http://lmgtfy.com/?q=PHP+forums
Ha! I've never seen that before! Laughed so hard at that…. So going to use that in the future!
11 posts
Posted 06 January 2013 - 02:26 AM
in php…how do you return something to a pc in minecraft? can you use echo to return something?
Using the echo function in PHP will print out data, accessing the page from your turtle should allow it to read what was echo'd.
25 posts
Posted 06 January 2013 - 03:54 AM
http://pastebin.com/cMYH7s7AIs that what you want?
Just forgot : the rmNonAlpha function will remove dots, so you can save file as "hello" but not "hello.txt" if it matters I'll change that