WebClient,... Can't get files using ".php?" types of links...

Greetings Folks !

We have a web crawler that searches the net for specific images... When the link is a simple href, we can easily get the file using :

WebClient myWebClient = new WebClient();
myWebClient.DownloadFile(m_remoteUri, sDestination);

But when the link is PHP based, the code above will not work.

Using the example below, how could we get the image in the page that this link will produce.
http://img120.imagevenue.com/img.php loc=loc24&image=f85_calvin.JPG

Thanks a lot!




Answer this question

WebClient,... Can't get files using ".php?" types of links...

  • Kris2006

    Could you be more specific, what do you mean by "will not work" If you just want to grab that image try the direct Uri to the image: http://img120.imagevenue.com/aAfkjfp01fo1i-31855/loc24/f85_calvin.JPG

  • Cassie1

    As Jorg notes above, on thing to do is ensure you set the UserAgent on your request to the same value of the browser.

    http://msdn2.microsoft.com/en-us/library/system.net.httpwebrequest.useragent.aspx



  • WillHart

    In fact, that's a second problem we had !

    We realized that the fact that our application isn't internet explorer is detected by the web application processing the http requests of getting the image files.

    We tried to figure out a way to surrogate ourselves to Internet Explorer. (i.e. Make our requests in such a way that the web application thinks it is comming from Internet Explorer !)

    Thanks for any help on this !



  • mahmut

    Again, this requires some analysis what's being sent over the wire. Probably the PHP script just redirects to the image's URL after performing some server side logic (like incrementing a hit counter).
  • Patrick14

    You're using a web application and don't fetch the file directly from the web server.

    The web application probably inspects the User-Agent header to check what type of browser is being used, or maybe it expects a cookie to be sent with the request. You'll have to find a bit more about how the web application works, e.g. by analyzing the HTTP traffic between a browser and the server. Tools like Fiddler are very useful for this.


  • SweatCoder

    If i could find the proper way to get this address (i.e. http://img120.imagevenue.com/aAfkjfp01fo1i-31855/loc24/f85_calvin.JPG) ...

    Right clicking on the image in Internet Explorer and selecting "properties" to get the direct Uri is an easy thing to do when Internet Explorer is used.

    How can my automated browser find this direct Uri address

    Thanks !



  • WebClient,... Can't get files using ".php?" types of links...