Solved

troubleshooting cURL

Posted on 2003-11-14
4
711 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
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 …

840 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