Bill
Bill

Reputation: 21

How do i check if php server allows external curl connections

How do i check if php server allows connecting via curl to external sites before buying hosting package (or registering on free host)? I noticed that in some hosting reviews users were complaining that servers that have curl enabled often don't allow external connections...

  1. I'd like to check this before purchasing/registering. Maybe there's some string in phpinfo which i can check (hosts sometimes link to their phpinfo so i don't need to be registered and create it myself) or something else i can do to check this without having account?

  2. If I have to register first... maybe there are some phpinfo-like scripts with more extensive informations that i could upload and run to quickly test host?

Upvotes: 2

Views: 6806

Answers (2)

Jeremy Morgan
Jeremy Morgan

Reputation: 3372

Create a file like this:

<?php 
phpinfo();
?>

or

<?php
echo "<pre>";
var_dump(curl_version());
?>

That will tell you instantly.

Also, most free hosts do not offer Curl by default, due to abuse by spammers.

Upvotes: 2

pixeline
pixeline

Reputation: 17984

You'll definitely need to buy an account before testing the server's capacities.

But some hosts allow you to test their site with a monthly contract or a XX days money back guarantee. From the top of my head, Host gator is such host.

Then when you have that account, try a small script like this (check the path to curl with your host helpdesk or documentation):

<?php
$var = echo shell_exec("/usr/bin/curl -L http://www.google.com");
?> 

Upvotes: 1

Related Questions