Solved

troubleshooting cURL

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

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
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…
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 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…

832 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