Solved

troubleshooting cURL

Posted on 2003-11-14
4
714 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

These days socially coordinated efforts have turned into a critical requirement for enterprises.
This article discusses how to implement server side field validation and display customized error messages to the client.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

724 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