TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Absolute Beginners (http://www.talkphp.com/absolute-beginners/)
-   -   Cannot use CURL? (http://www.talkphp.com/absolute-beginners/4051-cannot-use-curl.html)

allworknoplay 03-17-2009 08:30 PM

Cannot use CURL?
 
Hi,

I do have curl installed and I just can't get it to work. Here's my curl setup.


curl -V

curl 7.12.1 (i386-redhat-linux-gnu) libcurl/7.12.1 OpenSSL/0.9.7a zlib/1.2.1.2 libidn/0.5.6
Protocols: ftp gopher telnet dict ldap http file https ftps
Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz


Code:

<?php

        define("CURL_PATH", "/usr/bin/curl");
       
 $ch = curl_init('index.html');
 curl_setopt ($ch, CURLOPT_POST, 1);
 curl_setopt ($ch, CURLOPT_POSTFIELDS, "email_address=email&password=password");
 curl_exec ($ch);
 curl_close ($ch);
?>

I keep getting this error...

Fatal error: Call to undefined function: curl_init() in /usr/local/apache/test.html on line 5

Line 5 is this:

$ch = curl_init('index.html');

I tried both relative and absolute paths for the URL and it still doesn't work...

Wildhoney 03-17-2009 11:16 PM

Is it the cURL plugin enabled in php.ini?

allworknoplay 03-17-2009 11:51 PM

Quote:

Originally Posted by Wildhoney (Post 22314)
Is it the cURL plugin enabled in php.ini?

Nothing in php.ini but I did figure it out.

Eventhough I had CURL installed, I didn't have libcurl installed.

So I downloaded libcurl and installed it.

Recompiled my PHP with it, restarted Apache and now it works.

What I don't get is, what is the difference between libcurl and curl?

Is libcurl just some kind of wrapper for curl? I always thought that CURL was a PHP specific set of libraries...is it available for other languages like ASP, Perl etc?

Wildhoney 03-18-2009 09:55 AM

cURL, I think, is the PHP interfact to Libcurl. Libcurl is not just PHP orientated, it's used in many various instances.

sketchMedia 03-18-2009 10:15 AM

cURL is the stand-alone wrapper for the libcurl libraries. libcurl is not specific to PHP, its a commandline tool (via the curl commandline wrapper) and php has bindings for it (as do many other langauges).

Tanax 03-18-2009 11:42 AM

I have a question regarding this topic, didn't feel like starting an own thread for it.

I'm using WAMP, how would I install cURL(and also SSL) on it? I can't compile the PHP in it, or can I? And how?

Anyways, I'm just wondering.
I'm using Windows if that is important to know. But you probably knew that since I was using WAMP and not MAMP.

Salathe 03-18-2009 12:35 PM

Tanax, go to your PHP Info page (probably http://127.0.0.1/?phpinfo=1 ) and note down the location of the php.ini being used (probably <wamp_path>/bin/apache/<apache_ver>/bin/php.ini ).

Stop the apache service (clicking the systray icon has the option to stop all services). Edit the line which says ";extension=php_curl.dll" in the php.ini file -- remove the semicolon. Save it. Start the apache service.

In theory, that should work (go back to the PHP Info page to see if curl is loaded) but no guarantees. ^^

allworknoplay 03-18-2009 01:13 PM

Quote:

Originally Posted by Wildhoney (Post 22332)
cURL, I think, is the PHP interfact to Libcurl. Libcurl is not just PHP orientated, it's used in many various instances.

Quote:

Originally Posted by sketchMedia (Post 22333)
cURL is the stand-alone wrapper for the libcurl libraries. libcurl is not specific to PHP, its a commandline tool (via the curl commandline wrapper) and php has bindings for it (as do many other langauges).


Wow, I had it backwards! So CURL is the wrapper for libcurl, got it...

Tanax 03-18-2009 02:20 PM

Quote:

Originally Posted by Salathe (Post 22335)
Tanax, go to your PHP Info page (probably http://127.0.0.1/?phpinfo=1 ) and note down the location of the php.ini being used (probably <wamp_path>/bin/apache/<apache_ver>/bin/php.ini ).

Stop the apache service (clicking the systray icon has the option to stop all services). Edit the line which says ";extension=php_curl.dll" in the php.ini file -- remove the semicolon. Save it. Start the apache service.

In theory, that should work (go back to the PHP Info page to see if curl is loaded) but no guarantees. ^^

Thanks alot! It worked quite well ^^
Tho, I didn't find SSL there..

However:
Quote:

Originally Posted by phpinfo()
cURL support enabled
cURL Information libcurl/7.16.0 OpenSSL/0.9.8g zlib/1.2.3

OpenSSL = same thing as SSL(the thing you were talking about my error of context streams ??

Thanks alot!

And sorry for hijacking your thread allworknoplay.

allworknoplay 03-18-2009 09:52 PM

Quote:

Originally Posted by Tanax (Post 22340)

And sorry for hijacking your thread allworknoplay.

No problem. You should come to the LINUX side though...

:-P

Tanax 03-18-2009 11:21 PM

Yuck! No thanks xDD LINUX is.. bleeh!
I'm thinking however to buy a Mac next time ;-)

allworknoplay 03-18-2009 11:34 PM

Quote:

Originally Posted by Tanax (Post 22348)
Yuck! No thanks xDD LINUX is.. bleeh!
I'm thinking however to buy a Mac next time ;-)



Nothing wrong with MAC. I am thinking of getting one myself. The only problem is that they are so damn expensive...

Tanax 03-19-2009 07:33 AM

Indeed xD
But they're really good though, and I need one for my music studio :-)

xenon 03-19-2009 11:10 AM

Quote:

Originally Posted by Tanax (Post 22348)
Yuck! No thanks xDD LINUX is.. bleeh!
I'm thinking however to buy a Mac next time ;-)

...but you do know that Mac OS X is actually a UNIX based operating system, right? That means it's nothing different from any Linux distribution, except for the interface (and the fact that it's commercial).

Tanax 03-19-2009 12:46 PM

Quote:

Originally Posted by xenon (Post 22357)
...but you do know that Mac OS X is actually a UNIX based operating system, right? That means it's nothing different from any Linux distribution, except for the interface (and the fact that it's commercial).

Nope xDD
Well I hate LINUX's interface, that's what I mean.
And I love Mac's interface, it's great. A little difficult to understand in the beginning tho, but I'll get use to it :-)

allworknoplay 03-19-2009 03:31 PM

Quote:

Originally Posted by xenon (Post 22357)
...but you do know that Mac OS X is actually a UNIX based operating system, right? That means it's nothing different from any Linux distribution, except for the interface (and the fact that it's commercial).


That's the biggest key, "commercial" support.

It's what has kept Mac and Windows in the forefront for the longest time.

That has always been the issue with Linux. You have to be a certain type of individual to be a Ubuntu or some form of linux user...

Installation is getting easier and easier, but until commercial apps will support Linux, it will always be the 3rd wheel OS...from a consumer standpoint...

xenon 03-21-2009 07:24 AM

Quote:

Originally Posted by allworknoplay (Post 22361)
Installation is getting easier and easier, but until commercial apps will support Linux, it will always be the 3rd wheel OS...from a consumer standpoint...

I couldn't agree more. But linux was never made so that an individual can easily install some applications from a GUI. It has its share of the market, and does its job extremely well (I mean the job it was intended to do - advanced server management). The UI is just a fancy tool for the stupid (no offense intended to anyone, I myself use Windows). And we all know that fancy stuff sells the best (take a look at Flash on the web market), although it's not always the best choice.

Krik 03-21-2009 10:06 AM

Quote:

Originally Posted by Tanax (Post 22359)
Nope xDD
Well I hate LINUX's interface, that's what I mean.

Umm, that statement hints of error.

Yea command line isn't as nice as GUI (I must admit I miss my days of programing DOS 3.2, it was simpler). But for some reason I doubt you are referring the command line of Linux and are referring to one of over 1000 GUI's built for Linux (not counting custom built GUI's).

I have seen GUI's for Linux that could make you swear it was a Windows OS, same goes for the Mac OS. The only real hindrance is usually found in that the software you would want to use with Linux not being available or very difficult to configure.

I personally insist on Linux servers for my web design. Last I worked with a Linux machine, hands on, was almost 4 years ago when I was consulting on a backoffice server. I personally use Windows systems for all my PC's and would only get a Mac if I was doing CGI rendering. And even then I would set it up to run Windows within the Mac OS for when I wasn't doing CGI.

allworknoplay 03-21-2009 08:24 PM

Quote:

Originally Posted by xenon (Post 22415)
I couldn't agree more. But linux was never made so that an individual can easily install some applications from a GUI. It has its share of the market, and does its job extremely well (I mean the job it was intended to do - advanced server management). The UI is just a fancy tool for the stupid (no offense intended to anyone, I myself use Windows). And we all know that fancy stuff sells the best (take a look at Flash on the web market), although it's not always the best choice.


Right. I think it is Novell? That bought SuSe? And is trying to make it a standard corporate desktop OS, and seems to be failing miserably.

I remember this one company was being trained to use their OS and get rid of Windows but good luck on that....

The thing is, Windows isn't a bad OS! There are different types of users....

I use Windows for everything desktop related. I use Redhat/CentOS for all my heavy duty server related roles....

I want to get into Mac but haven't had the chance yet. I've also wanted to try Ubuntu but I haven't had time. I don't want to be watered down too much and try to know every OS that's out there...

Flash is very very visually impressive, I actually use Flash for my graphs but I want to get away from it and just use some type of GD or PNG/JPG type graphs, I just haven't found any that look BETTER than my Flash graphs...

allworknoplay 03-21-2009 08:27 PM

Quote:

Originally Posted by Krik (Post 22417)
Umm, that statement hints of error.

Yea command line isn't as nice as GUI (I must admit I miss my days of programing DOS 3.2, it was simpler). But for some reason I doubt you are referring the command line of Linux and are referring to one of over 1000 GUI's built for Linux (not counting custom built GUI's).

I have seen GUI's for Linux that could make you swear it was a Windows OS, same goes for the Mac OS. The only real hindrance is usually found in that the software you would want to use with Linux not being available or very difficult to configure.

I personally insist on Linux servers for my web design. Last I worked with a Linux machine, hands on, was almost 4 years ago when I was consulting on a backoffice server. I personally use Windows systems for all my PC's and would only get a Mac if I was doing CGI rendering. And even then I would set it up to run Windows within the Mac OS for when I wasn't doing CGI.


Linux is hands down the best for webdesign. I know I'm bias but it's ok. The LAMP structure is the best that's out there....

I would be interested in knowing what the current market share is between Apache and IIS.

I've always had a hell of bad time with IIS back in the days when I was coding in ASP.

I'd like to experience a Ubuntu or some form of linux that looks exactly like Windows or Mac...I would probably love using it for entertainment purposes...

The way I use linux now is pure command line...


All times are GMT. The time now is 08:29 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0