cURL / Mailing Lists / curl-users / Single Mail

curl-users

Passing Username and Password via PHP into curl - Suggestions

From: Keith Stiles <jk_stiles_at_blueridge.edu>
Date: Wed, 10 Aug 2011 16:07:55 -0400

Hi,

I have been working on a script that iterates through a CSV file creating
some data that is uploaded to a webservices implementation. The script
successfully uploads. the command line for the curl in my PHP script is as
follows:

passthru ('curl -k -u *username*:*password* -F
"upload=</home/omniupdate/public_html/brcctv/25live_imports/Library;type=text/xml"
https://webservices.collegenet.com/r25ws/wrd/blueridge/run/events.xml');

The curl works if I physically enter my username and password in the
location. However, if I try to pass the values of variables to the curl as
follows:

passthru ('curl -k -u $username.":".$password -F
"upload=</home/omniupdate/public_html/brcctv/25live_imports/Library;type=text/xml"
https://webservices.collegenet.com/r25ws/wrd/blueridge/run/events.xml');

The curl command fails to successfully pass the authorization to the
webservice.

I have verified that the $username and $password variables are populated
with the correct values. Any ideas how I could get this to work?

Thanks,
Keith

***************************************************************
Keith Stiles
Webmaster/Web Services
Blue Ridge Community College
180 West Campus Drive
Flat Rock, NC 28731-4728
Phone: (828) 694-1894

www.blueridge.edu

Our mission...enriching the lives of those within our reach through
education, training and cultural activities.
***************************************************************
E-mail correspondence to and from this address is subject to the
North Carolina Public Records Law. (NCGS.Ch.132)

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-08-10