cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Passing Username and Password via PHP into curl - Suggestions

From: Tim Tessier <ttessier_at_swhistlesoft.com>
Date: Wed, 10 Aug 2011 16:48:11 -0400

if you performed that on a script that actually captures the command line
and writes it to a file, then you can make sure that the values you expect
are actually being passed. You could always use the php curl module however,
that is not always enabled. So... I would suggest passthrough ( 'bash -c
echo $username.":".$password'); You may find that the use of single quotes
is doing something funny.

See:
http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.single

I believe that you may be looking for something like:

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"<https://webservices.collegenet.com/r25ws/wrd/blueridge/run/events.xml%27>
);

On Wed, Aug 10, 2011 at 4:07 PM, Keith Stiles <jk_stiles_at_blueridge.edu>wrote:

> 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
>
>

-------------------------------------------------------------------
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