Answer the question
In order to leave comments, you need to log in
Internet bot. Why is it impossible to implement downloading with "redirection"?
I am writing a bot in php, among other things, it must log in (I use cURL) and download files. You can download only when the user (or bot) is authorized. Authorization turned out to be done, but there is no download.
With a "redirect" - no entry on your server. Toist immediately give to the user.
I send a POST request to the server with the necessary data (fileId and VerificationToken which are in the html code of the page). It returns json to me in which there is a link to the redirect (if you download normally in the browser, then the download starts automatically).
JSON
redirectUrl=http://s5905.somesite.pl/File.aspx?e=dlinnyj_hasz_kod
refreshTopBar=False
topBar=<div class="topbarLoginContainer"> html контейнера для авторизации, также 2 ссылки на картинки, но картинки больше чем 1х1</div>
trackingCodeJS=_gaq.push(['ch._trackEvent', 'Files', 'Download', 'Download_File']);
Type=Redirect
Object moved to <a href="/Error.aspx?aspxerrorpath=/File.aspx">here</a>.
Answer the question
In order to leave comments, you need to log in
Successful download. Mainly due to the fact that the site is poorly protected.
I just did not notice the \u0026 character in the long hash code of the response (json format), which in the subsequent get request must be replaced with &. Thus, two parameters will be sent and not one, as I did before.
This is hardly possible. If you just try to save cookies additionally and not just throw a link, but also implement saved cookies. Then if the site keeps the session for a long time per file, then it will be possible to download. No, well, then it's not realistic in this condition. After all, when you click on a link, you are already a completely different client for the site, not the one who requested the link for the first time. Accordingly, this is the result.
As far as I remember, from the experience of picking php-proxy, I can say that through curl it was only possible to save the content of the file into a variable, and then display it to the user. The file size is limited by the memory available for php.
When using sockets, you can stream download - i.e. read part of the file - gave it to the client. Here http://sourceforge.net/projects/poxy/ you can see the principle.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question