Current time: 11-27-2024, 12:31 PM Hello There, Guest! (LoginRegister)


Post Reply 
Problem with libcurl
Author Message
gnatbite Offline
Newbie
*

Posts: 8
Joined: Apr 2007
Reputation: 0
Post: #1
Problem with libcurl
Hi guys, I installed libcurl for a Online shop running on my server. This online shop needs libcurl to commuicate with a special creditcard company. So I installed libcurl but I have got a problem. The curl library is not working properly.

That's what I have done.

- Created a normal domain for the shop
- Changed to PHP5 (like described here)
- Installed Zendoptimizer (necessary for the online shop)
- Installed libcurl
- Added Zend and Curl to the corresponding php.ini
Code:
zend_extension=/usr/lib/php5/ZendOptimizer.so
zend_optimizer.optimization_level=15
extension=curl.so

infophp() says that zend and curl are installed:

Code:
Zend OptimizerOptimization Pass 1     enabled
...

Code:
cURL support     enabled
cURL Information     libcurl/7.15.5 OpenSSL/0.9.8c zlib/1.2.3 libidn/0.6.5

But if I try to use the curl library, it doesnt work like it should.

Example from here
Code:
<?php

$ch = curl_init("http://www.example.com/");
$fp = fopen("example_homepage.txt", "w");

curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);

curl_exec($ch);
curl_close($ch);
fclose($fp);
?>

If I do understand correct, the code above should write the index-page from example.com to the specified textfile: example_homepage.txt

But it doesnt do that. Instead of that, i get the following content in the textfile.

Code:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="https://myispcp-domain.com/">here</a>.</p>
<hr>
<address>Apache/2.2.3 (Debian) mod_fastcgi/2.4.2 mod_ssl/2.2.3 OpenSSL/0.9.8c Server at www.mydomain.com Port 80</address>
</body></html>

That seems to be kind of webpage generated by ispcp or something, because there is a link to my default ispcp-login. By the way, the domain myispcp-domain.com is also my hostname. Any ideas?

Does someone have any idea?
06-13-2007 02:17 AM
Find all posts by this user Quote this message in a reply
BeNe Offline
Moderator
*****
Moderators

Posts: 5,899
Joined: Jan 2007
Reputation: 68
Post: #2
RE: Problem with libcurl
Maybe a new FastCGI problem Rolleyes
ephigenie knows perhaps a solution.
06-13-2007 03:35 AM
Visit this user's website Find all posts by this user Quote this message in a reply
ephigenie Offline
Project Leader
*******
Administrators

Posts: 1,578
Joined: Oct 2006
Reputation: 15
Post: #3
RE: Problem with libcurl
mh the 301 is a redirection have you tried a remote site ? does that work ?

Perhaps the local site you want to access is redirected ... ? and curl just doesn't follow the redirection.
This could happen if you use a alias domain as target which directs to another domain on your server.

Please try with http://www.google.com ?
06-13-2007 06:06 AM
Visit this user's website Find all posts by this user Quote this message in a reply
gnatbite Offline
Newbie
*

Posts: 8
Joined: Apr 2007
Reputation: 0
Post: #4
RE: Problem with libcurl
ephigenie Wrote:mh the 301 is a redirection have you tried a remote site ? does that work ?

Perhaps the local site you want to access is redirected ... ? and curl just doesn't follow the redirection.
This could happen if you use a alias domain as target which directs to another domain on your server.

Please try with http://www.google.com ?

Hi, thx for your reply. After 4 hours I finally found the problem. There was a wrong DNS-Entry on the local DNS-Server for der second domain.
06-13-2007 07:51 AM
Find all posts by this user Quote this message in a reply
katun Offline
Junior Member
*

Posts: 20
Joined: Dec 2007
Reputation: 0
Post: #5
RE: Problem with libcurl
how do i install libcurl for php5-cgi?
01-09-2008 07:54 AM
Find all posts by this user Quote this message in a reply
joximu Offline
helper
*****
Moderators

Posts: 7,024
Joined: Jan 2007
Reputation: 92
Post: #6
RE: Problem with libcurl
maybe "apt-get install libcurl3"
or is there a probem?
01-09-2008 08:32 AM
Visit this user's website Find all posts by this user Quote this message in a reply
katun Offline
Junior Member
*

Posts: 20
Joined: Dec 2007
Reputation: 0
Post: #7
RE: Problem with libcurl
hmm. on my testserver (ubuntu, no ispcp, no fcgi) i typed "apt-get install php5-curl". Now the question: Can I do it identical on a debian system with ispcp and fcgi?
01-09-2008 08:54 AM
Find all posts by this user Quote this message in a reply
joximu Offline
helper
*****
Moderators

Posts: 7,024
Joined: Jan 2007
Reputation: 92
Post: #8
RE: Problem with libcurl
just try it...
I just did it - seems to work... "apt-get install php5-curl" is good
01-09-2008 09:16 AM
Visit this user's website Find all posts by this user Quote this message in a reply
BioALIEN Offline
Public Relations Officer
*****
Dev Team

Posts: 620
Joined: Feb 2007
Reputation: 5
Post: #9
RE: Problem with libcurl
Yes it should work fine, I did it a while back and works exactly as should. There was a problem with cURL about following location which seems to be no longer supported on php5+. If you experience any errors, comment that line out of your scripts Smile
01-09-2008 02:26 PM
Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)