The page is sending the file in curl, I want to get the download link insted

there is a page where i need to send the password and then i get the file to upload. the message goes to the same page address as its download and the download manager appears (download starts automatically). now i want to do the same, but in curl, i have sent the data to url and then send the file back to me, but i dont want my script to download the whole file, i only want to get the download link this is myself. How can i do this?

+2


a source to share


4 answers


Actually, you most likely cannot. Such a password protected security system usually checks for cookie or browser / environment variables. Getting the link itself shouldn't be a problem, however you can't use it outside of this generator scope.



0


a source


first, you need to send this password with curl, assuming "in a specific form, the form will take you to the download page", now you need to use a regex (regex). filter the data you want, then store it in another variable to reuse it.



0


a source


For sure a redirect after you hit 1st page with POST. Look at this redirect with curl and read the HTTP response headers: Content-Location or Location or even Refresh

0


a source


To prevent automatic loading, you must set curl to not follow redirects. I can't remember the exact command, but the default curl will follow automatic updates and URL redirects that happen within seconds, so people don't really see it happening.

I don't seem to understand what you really want to do, but if you just want a link, have the php script execute the entire curl entry and that's it when they click. It doesn't matter that the web server requires a password before accessing the file, you cannot skip this step.

0


a source







All Articles