質問

There is a website that shows an image but you cant download it. It uses background techniques and forces javascript to avoid save as and when you find the file image url in the code you cant directly access it. I would like to know how to reproduce this and how can I get the file. I looked in cache but cant find it. In resources in chrome dev tools i can see the image full size but cant save it without printscreen.

It must have something to do with htaccess i think but not sure.

Edit: The block should be similar to this one I'll try setup a little test like this: (htaccess) How to prevent a file from DIRECT URL ACCESS?

If the jpeg is shown in http://localhost/test/ but http://localhost/test/sample.jpg throws an error how can I get the file through cURL?

正しい解決策はありません

他のヒント

A good place to start would be trying to curl or wget the url (you can find the URL in chrome dev tools).

Posting the result here if it's unsuccessful will also help.

If it is in fact being denied at the request level (which is what Apache would be doing if it was done with an .htaccess file), there are likely headers or cookies that allow it to be requested by the app.

If the image isn't drawn on the page using javascript, you can also just simply turn off javascript, which would allow you to right-click and save the image normally, if the app is preventing access on the client.

Check out the headers & cookies sent when requesting the image, and either use those in curl or an app like GraphicalHTTPClient.

Edit: here's an image of the chrome dev tools, with the headers for an image showing. You'll find this in the "Network" panel in dev tools. Note that the tools must be open when the image loads.

Headers & Cookies in Dev Tools

One side note: .htaccess files are used by apache, which is just a server, and doesn't necessarily have anything to do with php. It's pretty unlikely that the app is denying from their php code (if the app is even written in php), as serving images via php is very uncommon.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top