Solved

troubleshooting cURL

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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 …

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now