[PHP] Please Help with a php script
#1
Posted 05 January 2013 - 04:34 PM
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)
#2
Posted 05 January 2013 - 05:39 PM
#3
Posted 05 January 2013 - 05:47 PM
#4
Posted 05 January 2013 - 05:48 PM
#5
Posted 05 January 2013 - 05:59 PM
DLCruze: Where are some good forums
#6
Posted 05 January 2013 - 06:03 PM
Dlcruz129, on 05 January 2013 - 05:48 PM, said:
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!
#7
Posted 05 January 2013 - 06:15 PM
snoble2022, on 05 January 2013 - 05:59 PM, said:
DLCruze: Where are some good forums
http://lmgtfy.com/?q=PHP+forums
#8
Posted 05 January 2013 - 06:16 PM
I made something very similar there : http://www.computerc...-web-interface/
#9
Posted 05 January 2013 - 11:33 PM
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.
#10
Posted 06 January 2013 - 01:40 AM
#11
Posted 06 January 2013 - 01:52 AM
#12
Posted 06 January 2013 - 02:16 AM
Dlcruz129, on 05 January 2013 - 06:15 PM, said:
snoble2022, on 05 January 2013 - 05:59 PM, said:
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!
#13
Posted 06 January 2013 - 02:26 AM
awsumben13, on 06 January 2013 - 01:52 AM, said:
#14
Posted 06 January 2013 - 03:54 AM
Is 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
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











