Problem with cURL

3 posts / 0 new
Last post
#1 Tue, 04/26/2011 - 15:05
etrader

Problem with cURL

Something is missing in php (curl) installation of Virtualmin. cURL does not work properly. When using something like

$ch = curl_init(); curl_setopt($ch, CURLOPT_USERAGENT, 'Googlebot/2.1 (http://www.googlebot.com/bot.html)'); curl_setopt($ch, CURLOPT_URL,"http://www.yahoo.com"); curl_setopt($ch, CURLOPT_FAILONERROR, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_REFERER, 'http://www.google.com/bot.html'); curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); curl_setopt($ch, CURLOPT_TIMEOUT, 10); $html = curl_exec($ch); curl_close($ch);

it automatically echo $html and show the content.

Tue, 04/26/2011 - 15:13
andreychek

Howdy,

Not all the PHP modules are installed by default (if it did, the RAM requirements for running a web server would be rather extraordinary).

However, that's something you can install at any point using yum or apt, depending on your distro.

If you're using CentOS, you can run: yum install php-curl

If you're using Ubuntu or Debian, you can run: apt-get install php5-curl

Wed, 04/27/2011 - 01:02
etrader

I just found, it is not the curl problem (sorry), but it is related to difference in preg_match.

Topic locked