phporcaffeine Posted June 28, 2007 Share Posted June 28, 2007 Interesting project here: I'm using PHP (CLI) on a client machine, and I need a script on the client (executed via CLI) to transfer/upload a file to a web server using HTTPS (I could use HTTP if I have to). The catch is, I can't use FTP methods (firewall/port issues) ... but I have complete control over the client machine as well as the server machine. I can however use the following ports; 8080, 443 & 3306. I realize that of the three ports I can use, 8080 would be the best but still not suited for mass data blocks. I think 8080 will be okay because I am transferring files that are less than 5k. Anywho, I thought I could get away with fopen() but I'm reading in the manual that the HTTP & HTTPS wrappers are 'read-only' which isn't going to work (because I am trying to write a file to the server, not read one). So as I research further I am think that somehow 'sockets' might do the trick. I have a very basic understanding of sockets & php but I would like to know if I could do what I am trying to do using sockets? -TIA Quote Link to comment Share on other sites More sharing options...
corbin Posted June 28, 2007 Share Posted June 28, 2007 Ummm no offense, but that made no sense at all. So you're trying to upload a file to a webserver using PHP? Google PHP uploads... No fancy socket manipulation is necessary or anything. If you mean you want to upload a file, and then the server run it before saying something, then that's possible in the same way. Quote Link to comment Share on other sites More sharing options...
phporcaffeine Posted June 28, 2007 Author Share Posted June 28, 2007 Ummm no offense, but that made no sense at all. So you're trying to upload a file to a webserver using PHP? Google PHP uploads... No fancy socket manipulation is necessary or anything. If you mean you want to upload a file, and then the server run it before saying something, then that's possible in the same way. Wouldn't I need a script on the server to accept the $FILES[] post from the CLI script? See I'm trying to avoid user interaction. I guess I could 'forge' a form submit with JavaScript but I don't know if echo'ed JS will work in CLI? Quote Link to comment Share on other sites More sharing options...
corbin Posted June 28, 2007 Share Posted June 28, 2007 Oooohhhh!!! I get what you're trying to do now.... You could do it via the cURL library maybe.... Quote Link to comment Share on other sites More sharing options...
phporcaffeine Posted June 28, 2007 Author Share Posted June 28, 2007 Oooohhhh!!! I get what you're trying to do now.... You could do it via the cURL library maybe.... Okay, I'll google up on cURL BTW: Using PHP in CLI means I wouldn't have a browser, which means no HTML which means no FORM to POST with ... etc Thanks Quote Link to comment Share on other sites More sharing options...
corbin Posted June 28, 2007 Share Posted June 28, 2007 Yeah I misunderstood it and thought you meant you were using PHP in CGI mode, and there was confusion on your part ;p. My mistake entirely, though. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.