How to open a browser in PHP? - php

Im here to ask a probably dumb question again. This is related to my previous questions.
I current found a way for flash/flex to send a video file(in byteArray) to php. Where php receives and writes it in the local sytem then sends it to the youtube server automatically trhu a script.
This is all backend though I have no way to check if the video file was uploaded succesfully in youtube than to check it manually in youtube.
So im thinking of a new php script where it will receive and write the video file from flash. Then opening a browser window where it will automatically upload the video and at the same time track it thru the browser of its status using debug prints perhaps.
Im barely still learning php. I tried to do some research on this but found no success. Hope you can help me guys. Thanks.

PHP code runs on your web server. It's code running on another computer. It can't open anything on YOUR computer. If it could, I would also be able to open windows on YOUR computer from the one I'm typing on, and you'd have some serious problems. By tomorrow everyone in the world would have their computers either taken over or destroyed by other random people on the internet.

PHP is server side, you can't directly use any PHP code to control browser activity on client side.
You need to resort to client side technology such as Flash and JavaScript.

echo "XXX window.open('URL');XXX'
XXX = script tag from Java, I can't post html tags

Related

Include html from remote server Edit then save on remote server

Let me begin with, that English is not my native tong.
There probably gonna be some miss-pelt words/sentences.
Explaining the situation:
I have bought a script for a lot of money that allows me to put it in the root directory and edit the static html documents with specific tags.
It saves the changes direct on the html.
i use it for old clients that bought a website from me a wile ago. (static html css websites)
Now i dont want to put the script on their own webserver, i would practically be giving away a script where somebody put a lot of time in.
The plan
Now i plan to put it on my own server next to my website.
The script allows me to save through a ftp connection.
so its save to say that it is possible to save from a remote server.
I manage to make a simple user script that let the client log in than php gets the ftp information from my sql server for the "ftp save function".
But now the real question
Is it possible for me to let my clients login onto my webserver and then "Include" their website into the session on my server and let the editor do his thing ?
so the script has to thing that it is on the root of the html document.
My explaining is probably unclear so let me add a image ;)
picaso
Thank you for your time ..
Hope to hear something from you all.

Using batch code in php

Is it possible to make a php code on a webpage send out a code that the visitor will run? Like:
<?php
batch("echo text");
?>
Then it will open a cmd window that says text. If it does not work in php does it work in another launge?
PHP runs on a server and has no magical control over what happens on someone else's computer. Once the page has loaded it will be send to the requester's browser.
From there you have access to some local storage/cookies/etc., but only what the browser provides to you. If the browser would give a website access to the cmd, it would mean that any website could simply read pretty much everything on anyone's computer, or do harm in many other ways. You can imagine that this is not really secure.
The only way you can execute batch commands on someone's computer is if you or your program have access to that computer. In other words, the user must download your batch/.exe file and run it manually.

Web sockets to grab live data from my server

I'm wanting to push real time data to my website via web sockets. The data is basically just text saying "Artist - Title", it is generated via my Windows server that is streaming live constantly.
Can anybody point me in the right direction (i.e a manual/knowledge site) where I can read up on what will be required? Right now I have a PHP script that is pulling data from the MySQL database on my server, that then drops it onto my site as described above (Artist - Title) - obviously this doesn't accomplish what I want as it requires people to refresh the site every time they want to see what's currently being streamed, what I want is for it to just appear the second it starts playing on my server.
I've tried researching into web sockets with no prevail to what I want to accomplish. If anybody has the knowledge as to what I'm missing to make this work I would be most appreciative of your answer.
Consider running a Node.js server with socket.io. See socket.io chat app tutorial and it should become clear.
Basically you need JavaScript on your page to open the socket and respond to messages.

Can PHP running on a remote server handle files on my computer?

I'm very new to programming, I know only HTML/CSS. I have an idea, I want to make a ittle more dynamic website. I want to find the programming language that suits my needs. The website I imagined should have a function like that:
If I go to the website there's a button. If I click on that button, theh website displays the files and folders of my local hard drive, for example my computer's C: partition. After that if I click on a file or folder, the program deletes that file.
Can PHP running on remote server handle local files like that? Can PHP program access my files from a remote server? If the answer is 'yes', could you help me with little code snippet, how can PHP do that, which part of the language can handle this situation?
Or do I have to choose another programing language?
(I ask about PHP because it seems to be the "first step" towards making dynamic websites and it's for general use. It would be good not to learn a very specific programming language as my first programming language...)
No it can't. You will need some java applet plus certified authorization or some VBScript with client approval. PHP ran only at server side and return the result as html to the web client
No. The remote server can only handle files you explicitly upload to it.

FTP-upload with PHP, print simple percentage?

hey guys,
i know there are a lot of "for-me-too-complicated" versions of progress-bars for php uploads out there.
however i have only a really basic knowledge of php and i have no idea how to implement this stuff.
i did a working file-upload script that transferres files from the user to my ftp-server. i'm using ftp_connect and ftp_put to do so.
i wonder how complicated it is to print a SIMPLE percentage value on to the page, to let the user know how far the upload has progressed.
i don't want any animated javascript stuff, just a simple percentage that shows the progress.
do you know a tutorial or something, or can you maybe give me a little explanation how i could do that. at least which methods return a progress value.
thank you in advance,matt
I know you said the flash uploaders are too complicated for you and you need a simple solution but the truth is there are none. If you could start your project over I would recommend using some known CMS with file upload support.
I think you should really give something like uploadify another chance. If you have problems with it ask here! There is a uploadify tag and really helpful peoples.
edit after your commenht: As seen on this page theres the idea to use uploadify to get the file to yoru server and then move it normally using ftp to your other space/server.
PHP/Apache talks to the client in a single request only. There is no simple way to actually have the client (know) how far the server is in the process. On uploads the file travels from the client to the server, so we generaly use Flash that can give us that information.
client (flash) -> server
What you are asking is something a bit fancier
client -> server -> ftp
And you want to know the progress between the server and the FTP. Mind you that even if you don't realize it the files are actually beeing transfered to the server and then from the server to the FTP server.
You will probably want to have the server update a database on given intervals with the progress so far and have the client AJAX the server to find out where the server is at.
You can also give socket.io a look!

Categories