MySQL_Narb Posted July 10, 2013 Share Posted July 10, 2013 Hi, I've been working on this problem for the past hour. I can't seem to figure out how to save a CAPTCHA image. As we all know, a CAPTCHA image is only generated once. So this complicates things for me. http://api.solvemedia.com/papi/challenge.noscript?k=YofwLNxxBvEMSuDl.BVlHV-zV-MV8L61 As you can see in the above URL, any attempt to visit the direct image link will still result in a new image. Is there any possible way to get the image as is when you first load the webpage? I'm starting to think this is near impossible in PHP. Quote Link to comment Share on other sites More sharing options...
Solution requinix Posted July 11, 2013 Solution Share Posted July 11, 2013 As you can see in the above URL, any attempt to visit the direct image link will still result in a new image.If you keep refreshing the page, well yeah. So only visit the page once. Is there any possible way to get the image as is when you first load the webpage? I'm starting to think this is near impossible in PHP.The browser is the one that retrieves the image. Intentionally. If you're using PHP then it won't retrieve the image unless you write code telling it to. Intentionally. Quote Link to comment Share on other sites More sharing options...
MySQL_Narb Posted July 11, 2013 Author Share Posted July 11, 2013 If you keep refreshing the page, well yeah. So only visit the page once. The browser is the one that retrieves the image. Intentionally. If you're using PHP then it won't retrieve the image unless you write code telling it to. Intentionally. Well, is it possible to download a CAPTCHA image without "requesting" it again (maybe from a page that is already loaded)? Say you use cURL to load the page and grab the url of the image; you then tell cURL to download that image in the URL. It downloads the CAPTCHA image; however, when you go to download the image, is that not another request resulting in a changed CAPTCHA picture? Quote Link to comment Share on other sites More sharing options...
kicken Posted July 11, 2013 Share Posted July 11, 2013 is that not another request resulting in a changed CAPTCHA picture? No, because there was never a request to the captcha when you downloaded the page. You'd just be emulating how a browser works: 1) Download the HTML source of the page 2) Parse the source to acquire the captcha URL 3) Download the image from the captcha URL. That is what the browser does, then it displays the image it gets on the page where necessary. You'd have your script do the same thing, but rather than display the image save it to a file. Quote Link to comment Share on other sites More sharing options...
MySQL_Narb Posted July 11, 2013 Author Share Posted July 11, 2013 I figured it out. I was making an unnecessary request. Appreciate all the help. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.