# Problem with cURL

**URL:** <https://forum.virtualmin.com/t/problem-with-curl/39352>\
**Category:** Virtualmin\
**Created:** [April 26, 2011, 8:05pm UTC](https://forum.virtualmin.com/t/problem-with-curl/39352 "2011-04-26T20:05:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![etrader](https://cdn.forum.virtualmin.com/letter_avatar_proxy/v4/letter/e/b5e925/32.png) [@etrader](https://forum.virtualmin.com/u/etrader)\
**Post date:** [April 26, 2011, 8:05pm UTC](https://forum.virtualmin.com/t/problem-with-curl/39352/1 "2011-04-26T20:05:59Z")

</div>

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](http://www.googlebot.com/bot.html))’);  
curl\_setopt($ch, CURLOPT\_URL,“[http://www.yahoo.com](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](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.

---

<div class="post-metadata">

**Author:** ![Eric](https://cdn.forum.virtualmin.com/letter_avatar_proxy/v4/letter/e/898d66/32.png) [@Eric](https://forum.virtualmin.com/u/Eric)\
**Post date:** [April 26, 2011, 8:13pm UTC](https://forum.virtualmin.com/t/problem-with-curl/39352/2 "2011-04-26T20:13:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![etrader](https://cdn.forum.virtualmin.com/letter_avatar_proxy/v4/letter/e/b5e925/32.png) [@etrader](https://forum.virtualmin.com/u/etrader)\
**Post date:** [April 27, 2011, 6:02am UTC](https://forum.virtualmin.com/t/problem-with-curl/39352/3 "2011-04-27T06:02:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://cdn.forum.virtualmin.com/uploads/default/original/2X/c/cd96d761e326db4b2bef94886a639109bd7a8e76.svg) [@system](https://forum.virtualmin.com/u/system)\
**Post date:** [April 30, 2020, 5:51am UTC](https://forum.virtualmin.com/t/problem-with-curl/39352/4 "2020-04-30T05:51:53Z")

</div>

Closed on April 30, 2020, 5:51am UTC


