remote-server

php - How to force download of a file?

旧街凉风 提交于 2019-11-26 11:22:36
I'm looking to add a "Download this File" function below every video on one of my sites. I need to force the user to download the file, instead of just linking to it, since that begins playing a file in the browser sometimes. The problem is, the video files are stored on a separate server. Any way I can force the download in PHP? You could try something like this: $file_name = 'file.avi'; $file_url = 'http://www.myremoteserver.com/' . $file_name; header('Content-Type: application/octet-stream'); header("Content-Transfer-Encoding: Binary"); header("Content-disposition: attachment; filename=\"".

How to send data to remote server using Javascript

删除回忆录丶 提交于 2019-11-26 11:17:59
问题 I need to send data to a remote server using javascript. How do I do this? Background info: There\'s a webpage from which I extract some information using JS, and I need to send it back to another server for processing. Response is not neccesary. The data is XML, Which I\'ve URLencode\'d. How would one do this? EDIT The server I\'m requesting the data from is not the same that receives the data. Just to clarify. 回答1: One of the most common ways to do this is AJAX. Here's how you perform an

Connecting to remote MySQL server using PHP

谁说我不能喝 提交于 2019-11-26 04:25:48
问题 I am attempting to connect to a remote MySQL server from my local machine virtualhost using the following code: $conn = mysql_connect(\"$dbhost\", \"$dbuser\", \"$dbpass\") or die(mysql_error()); mysql_select_db($dbname, $conn) or die(mysql_error()); My problem is that I am unable to connect locally, receiving the error: Can\'t connect to MySQL server on \'xxx.xxx.xxx.xxx\' (10060) This is not the case when I upload the same PHP file to the server. I am able to query the database with no

php - How to force download of a file?

会有一股神秘感。 提交于 2019-11-26 02:23:16
问题 I\'m looking to add a \"Download this File\" function below every video on one of my sites. I need to force the user to download the file, instead of just linking to it, since that begins playing a file in the browser sometimes. The problem is, the video files are stored on a separate server. Any way I can force the download in PHP? 回答1: You could try something like this: $file_name = 'file.avi'; $file_url = 'http://www.myremoteserver.com/' . $file_name; header('Content-Type: application

Remove a file from a Git repository without deleting it from the local filesystem

蹲街弑〆低调 提交于 2019-11-26 01:19:20
问题 My initial commit contained some log files. I\'ve added *log to my .gitignore , and now I want to remove the log files from my repository. git rm mylogfile.log will remove a file from the repository, but will also remove it from the local file system. How can I remove this file from the repo without deleting my local copy of the file? 回答1: From the man file: When --cached is given, the staged content has to match either the tip of the branch or the file on disk, allowing the file to be