Read an Excel file from a Link in PHP or CURL - php

I have a client project in which I have to read an excel file from following link:
https://app6.bosch.de/cgi-bin/WebObjects.dll/V5Prod_WES6.woa/39/wo/UpG9CtiiPkkyvA2ECwgqkg/41.0.1.3.21.1.1.9.9.0.2.27.3.17.7.1
Everytime a new link is generated, when we click on this link in normal site, it opens in a new tab an excel download option.
How to read the same file from my website using PHP (e.g. using curl)? I want to read this file and save it in my website directory automatically.

Related

how can i restrict a file being viewed or downloaded using url? i want same file to be downloaded using php script

I want to restrict a pdf file on my server from being viewed or downloaded. for example, when somebody types below url in browser and press enter.
http://example.com/pdf/sample-pdf1.pdf
the file should not be viewed or downloaded. instead, it should get redirected somewhere else or should display some error message
But, when i download the same file using php or html code, it should get downloaded
for example when i use below code in a php file, it should get downloaded.
[a href="http://example.com/pdf/sample-pdf1.pdf" download]Download[/a]
Insert .htaccess file inside pdf directory with content:
"Deny from all" -
That will not allow access that directory and files inside it via URL.

How to upload a pdf file to any information page in opencart2?

I need to find a way to upload a pdf file to my terms & services page in opencart2. I've looked for an extention, but the suitable extentsion are for opencart 1.5.x.
Is there a way to upload a pdf file and make it downloadable on the information page?
The easiest way would be to upload the file using FTP to a location within your website (e.g. the downloads subdirectory), then put a link to it on the information page using the information page editor. (e.g. http://www.tuinenmetgevoel.nl/downloads/myfile.pdf)

How to download PDF using PDF link with PHP

I want to know how to download file PDF from URL link or another source.
Example :
I have this link : www.nba.com/gamenotes/warriors.pdf if you click that link your browser automatically read the PDF and show the PDF or you can automatically download the PDF file using third party apps.
And i want to know a PHP code that download the PDF file from that link for example and save it to my computer
The idea is is
Load file from URL and then put content to user to download it.
file_put_contents("Tmpfile.zip", file_get_contents("http://someurl/file.zip"));
Try this
Download File to server from URL
http://4rapiddev.com/php/download-image-or-file-from-url/

How to create View and Download Links for files on Amazon S3

I am developing an App which uploads files i.e. images,pdfs,text documents to Amazon S3. I am able to upload the files using S3.php class.
I have to store two links to the file in the database , the first link is the link to view the file in the browser if it is an image or a pdf document. The second link is to download the file.
I am able to generate the URL for each of the file using :
$url = $s3->getAuthenticatedUrl($bucket,$uri,$expiry)
But clicking the URL starts downloading the file, also this URL has an expiry time. But I have to store the links in database for longer time.
I also have to display the images and pdfs inside the browser, How can I generate the links. Kindly help...

CSV files are opening as a page

I am new to web development and I am facing an abnormal issue with the CSV files.
I have a link to download a CSV file:
Sample CSV file
On my local machine it gives a dialog box for the download - that is correct and that is what I want.
When I upload the same code to my web server, it opens the csv file as a web page in the same browser tab. That I don't want, I want a dialog box for the download option!
Can anyone tell me what I am doing wrong or What I need to do?
You can add the following line to your .htaccess. All the CSV files will be forced to download if opened.
AddType application/octet-stream csv
It will add the MIME header to all csv files, so browser will understand that it needs to download the file, not show it.

Categories