开发者

How do i check if php server allows external curl connections

开发者 https://www.devze.com 2022-12-11 17:58 出处:网络
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 tha

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 开发者_如何学Cand run to quickly test host?


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.


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");
?> 
0

精彩评论

暂无评论...
验证码 换一张
取 消