Re: http post request with authentication
On Mon, May 23, 2016 at 09:00:39PM +, Michael Pfeffer via curl-library wrote: > At first i´m a newbie in using libcurl. I must login via http post (libcurl) > to http://earthexplorer.usgs.gov and collect images. I use the POSTFIELDS > data to set search criteria but it doesnt seem to work. How can i select a > option? How can i select a inputfield without name? > I even don't know if i ask the right questions. I used some other sides with > get request, it worked fine. > > curl_easy_setopt(curl,CURLOPT_URL,"http://earthexplorer.usgs.gov;); > curl_easy_setopt(curl,CURLOPT_USERPWD,"login:password"); > curl_easy_setopt(curl,CURLOPT_POSTFIELDS,"typeAddress=WRS1=3$rowAddress=3"); > curl_easy_setopt(curl, CURLOPT_VERBOSE, true); > curl_easy_setopt(curl,CURLOPT_FOLLOWLOCATION,true); It's unlikely the web site uses HTTP authentication for login. It more likely uses a cookie that is set following a POST to some other URL which must then be sent with the request. See https://curl.haxx.se/docs/httpscripting.html#Some_login_tricks >>> Dan --- List admin: https://cool.haxx.se/list/listinfo/curl-library Etiquette: https://curl.haxx.se/mail/etiquette.html
Re: http post request with authentication
On Mon, May 23, 2016 at 5:00 PM, Michael Pfeffer via curl-library < curl-library@cool.haxx.se> wrote: > At first i´m a newbie in using libcurl. I must login via http post > (libcurl) to http://earthexplorer.usgs.gov and collect images. I use the > POSTFIELDS data to set search criteria but it doesnt seem to work. How can > i select a option? How can i select a inputfield without name? > I even don't know if i ask the right questions. I used some other sides > with get request, it worked fine. > > curl_easy_setopt(curl,CURLOPT_URL,"http://earthexplorer.usgs.gov;); > curl_easy_setopt(curl,CURLOPT_USERPWD,"login:password"); > > curl_easy_setopt(curl,CURLOPT_POSTFIELDS,"typeAddress=WRS1=3$rowAddress=3"); > Is that really supposed to be "$rowAddress=3" instead of "=3" Ralph Mitchell --- List admin: https://cool.haxx.se/list/listinfo/curl-library Etiquette: https://curl.haxx.se/mail/etiquette.html
http post request with authentication
At first i´m a newbie in using libcurl. I must login via http post (libcurl) to http://earthexplorer.usgs.gov and collect images. I use the POSTFIELDS data to set search criteria but it doesnt seem to work. How can i select a option? How can i select a inputfield without name? I even don't know if i ask the right questions. I used some other sides with get request, it worked fine. curl_easy_setopt(curl,CURLOPT_URL,"http://earthexplorer.usgs.gov;); curl_easy_setopt(curl,CURLOPT_USERPWD,"login:password"); curl_easy_setopt(curl,CURLOPT_POSTFIELDS,"typeAddress=WRS1=3$rowAddress=3"); curl_easy_setopt(curl, CURLOPT_VERBOSE, true); curl_easy_setopt(curl,CURLOPT_FOLLOWLOCATION,true); Thanks --- List admin: https://cool.haxx.se/list/listinfo/curl-library Etiquette: https://curl.haxx.se/mail/etiquette.html