Issues with cURL and authentication

Discussion in 'Programming' started by blackburn2413, Jan 29, 2012.

  1. #1
    Hey everyone, stuck on what might be an easy one to some people. I have a REST api that I am authenticating with and I can't get it to authenticate with either the command line or through my php script. I tried command line and am working to get that working first, then I'll translate to php.

    Anyways here is what I am doing:

    
    c:\CURL\  curl -k -u test@testdomain.com:password -o testoutput.txt "API-URL-GOES-HERE"
    
    Code (markup):
    So I am using the -k as I know there is a certificate issue with this api test environment. Also as some background info, the api outputs the correct data if I throw this in any web browser on my machine:

    https://test%40testdomain.com:pass123@API-URL-HERE.com
    HTML:
    that DOES give me the correct output. Also, I had to use the %40 instead of the @ in my login email address as that was messing with the test I was trying in the browser. I also tried this in curl and the test failed. I got a bad credentials msg...

    **EDIT** When I have all the correct (verified valid) credentials in curl and the command line, I get no response, no errors, and no outputted file. I just get nothing and a new command prompt... That's also what I am getting in my php code at this point. I am checking for errors in with the php using: "echo 'Curl error: ' . curl_error($ch);" with no help either...

    Just looking for any pointers anyone might be able to offer. They would be greatly appreciated!

    Thx
     
    Last edited: Jan 29, 2012
    blackburn2413, Jan 29, 2012 IP