Web Hosting Talk







View Full Version : Need HELP with CURL/PHP secure https post with curl_exec()


hoser
04-10-2002, 10:09 PM
HELP!

Sorry about this long post, but I wanted to as much info in as I could. I will delete or edit it to reduce the length if a moderator wants me to, or if the consensus says so.

Anyone know about PHP/CURL or can recommend a BB, URL, or a person (consultant), or ANYTHING else that can help? Here is my problem:

I am setting up a site with a shopping cart (echoCart) to use with the ECHO merchant account (http://www.echo-inc.com) , from (http://www.openecho.com).

Its a PHP based cart that is based on an older version of the osCommerce cart (http://www.osCommerce.com) and it uses CURL to send transactions to their server. The site is hosted at HostWay. They are my second "tryout" in a 2 week period, the first one didnt have PHP with CURL support as they told me when I signed up. It takes forever to find a hosting site, I'm not looking forward to spending another week or two and more $$ trying to get this to work. Sorry for complaining so much, but I am frustrated.

From phpinfo() the versions they are running are: PHP 4.1.2, CURL 7.8.1, OpenSSL 0.9.6

When trying to send a transaction in, the scripts have an error when calling curl_exec(). I inserted "echo" statements after the call to print the return values from curl_errno() and curl_error().

The script uses CURL to send the data via POST to their secure server via a https://blahblah URL.

Here is the output:

curl_errno(): "27"
curl_error(): "SSL: couldn't create a context!"

On looking through the source code of CURL, The "27" is defined as CURLE_OUT_OF_MEMORY, however I doubt that this is actually occuring. If you look at the source code for CURL, there isn't a whole lot of information provided when errors occur. If it was my own server, I'd recompile CURL with more debug information to figure out what is going on.

I have read there are some problems with older versions of CURL and PHP. I called HostWay support and they couldn't offer any assistance, as this is a third party script. But, they said they *might* try to upgrade CURL to a newer version --- but I doubt they will. Who knows if this would solve the problem either.

I have been corresponding by email with an Echo-inc support tech, but he was quickly out of ideas, and they don't provide support for PHP/CURL, only things with their part of the cart.

When invoking CURL from the command line with the same fields as in the PHP script, which is set by:

curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

everything is fine. It WORKS from the command line, but NOT within the script.

I really want to get this going to take advantage of Echo-inc's great prices. I will have low volume and they don't charge any monthly fees if there is no activity.

Any ideas are appreciated greatly.

Thanks for your help! :)

insiderhosting
04-10-2002, 10:59 PM
I use echo with the cURL exec commands. Try to login to SSH and type in which curl. Post your output here. Also, after you type in which curl and get the curl version to see if it was compiled with openSSL support, type the following and post the output.
curl https://www.insiderhosting.com
If you see the source code of my page, then curl is working, if you don't then it is not compiled correctly.

hoser
04-10-2002, 11:16 PM
Hi Insiderhosting,

'which curl' results in:

/usr/local/bin/curl

curl -V results in:

curl 7.8.1 (i686-pc-linux-gnu) libcurl 7.8.1 (OpenSSL 0.9.6)

Running:

curl https://www.insiderhosting.com

results in the file I attached. The images aren't there, but the rest of the page is. I had to post it here as a .txt file, because evidently .html isn't allowed.

Can you get anything from this?

I'm hoping that if you're already running it, you can help. I did the stock install from the download.

Thanks!

hoser
04-10-2002, 11:22 PM
Hi Insiderhosting,

'which curl' results in:

/usr/local/bin/curl

curl -V results in:

curl 7.8.1 (i686-pc-linux-gnu) libcurl 7.8.1 (OpenSSL 0.9.6)

Running:

curl https://www.insiderhosting.com

results in the file I attached. The images aren't there, but the rest of the page is. I had to post it here as a .txt file, because evidently .html isn't allowed.

Can you get anything from this?

I'm hoping that if you're already running it, you can help. I did the stock install from the download.

Thanks!

insiderhosting
04-11-2002, 12:35 AM
Your .txt file appears to be a little different than mine. Can you please send me the file via e-mail to smizrahie[at]insiderhosting.com replacing [at] with @

You might also want to ask your host to upgrade cURL to version 7.9.6

Softicom.NET
04-11-2002, 03:58 AM
it looks to me hoser your curl is working just fine with ssl support installed

also suggest upgrading curl......latest vers out is 7.9.5