Solved

troubleshooting cURL

Posted on 2003-11-14
4
712 Views
Last Modified: 2008-02-01
I am supposed to use cURL to submit credit card information to a gateway. Our website wasn't configured to use curl, so we've had to install it ourselves. Now that it has been installed, it doesn't appear to me that it's working, as I've yet to get the cURL functions to produce ANY meaningful output. If somebody could help me troubleshoot my cURL install and suggest and server level fixes we may need to make, I'd appreciate it.

Okay, for starters, the phpinfo command for our server reports the following config options:
'./configure' '--with-apxs=/usr/local/apache/bin/apxs' '--with-xml' '--enable-bcmath' '--enable-calendar' '--with-curl' '--enable-ftp' '--with-gd' '--with-jpeg-dir=/usr/local' '--with-png-dir=/usr' '--with-xpm-dir=/usr/X11R6' '--enable-magic-quotes' '--with-mysql' '--with-pear' '--enable-sockets' '--enable-track-vars' '--enable-versioning' '--with-zlib'

and the curl section says that curl support in enabled with the following specific info:
libcurl/7.10.8 OpenSSL/0.9.6b zlib/1.1.4

However, when I try to run the following test script on the server, the browser simply redirects to some random page (which may have been previously configured as the 404 page, idunno):
<?

    $url = 'http://www.jesush.com;
     $ch = curl_init($url);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     $output = curl_exec($ch);
     curl_close($ch);

echo "<html><head></head><body><pre>$output</pre></body></html>";

?>

Shouldn't the above script produce some meaningful output in a curl enabled browser? What gives?
0
Comment
Question by:GroverDill
  • 2
  • 2
4 Comments
 
LVL 14

Expert Comment

by:ThG
ID: 9751431

I don't use cURL (i don't understand why not just fopen("http://www.jesush.com", "r")), but i can see a ' missing here:
    $url = 'http://www.jesush.com;
0
 

Author Comment

by:GroverDill
ID: 9752214
Believe it or not, the original file has a closing single-quote correctly placed after the string. I'm not sure how I borked that while transferring the text. Oh well...

Thanks for your comment ThG. Believe me, I'm certainly no fan of cURL at this point, except I think that somewhere along the line, this transaction will have to be carried out over an SSL connection which I think requires cURL. All the documentation for my gateway (LinkPoint, btw) seems to indicate that it requires cURL...
0
 
LVL 14

Accepted Solution

by:
ThG earned 250 total points
ID: 9752509
Well, I would try the following things (in this order):
- use error_reporting(E_ALL);
- try what happens curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
- make sure the url is valid and you can connect to it *from* the server where your script runs on.
- read the php man page for cURL including comments (http://www.php.net/manual/en/function.curl.php)
- start crying
0
 

Author Comment

by:GroverDill
ID: 9994986
Sorry to have taken so long to close this thread. I was never actually able to get cURL to work, and so had to opt for ThG's final solution and cry. Oh well, thanks anyway, ThG...
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question