in reply to get() from website hangs

I have a similar problem, except my perl script has NEVER been able to get anything at all. I have tried LWP::Simple, HTTP::Tiny, wget, and curl. None of them worked, not even once! I created a sample text file on another site and tried to fetch it using wget. And all it would do is say that it is downloading it, but then nothing got downloaded and all it gave me was an empty file. Every. Single. Time. HTTP::Tiny gave me an error message saying that it failed. ???

Since I am using a free perl hosting called Zettahost, I am wondering if it is possible maybe they do not let free users fetch web pages, or maybe it's a security issue and they don't want anyone to do that. I don't know. Maybe fetching web pages is a privilege that has not been granted to me. Is that possible? They use a Debian Linux server.

I tried to fetch website data using PHP, and it failed as well. So, there's got to be something with the server or the way it is configured. It's not letting me download anything!

<?php $fileHTML = file_get_contents('http://www.wzsn.net/'); $title = substr($fileHTML, strpos($fileHTML,'<TITLE>') + 7, strpos($fi +leHTML,'</TITLE>') - (strpos($fileHTML,'<TITLE>') + 7)); echo $title; ?>

It says, "Warning: file_get_contents(http://www.wzsn.net/): failed to open stream: Connection refused in /srv/disk13/2468845/www/ildispaintings.com/xget.php on line 7"

Replies are listed 'Best First'.
Re^2: get() from website hangs
by trwww (Priest) on Sep 14, 2019 at 01:42 UTC

    Yes it looks like zettahost does not allow outbound network connections by default. I just typed 'Zettahost outbound network connections' in to google and got:

    http://zettahost.runhosting.com/faq.html

    15. I cannot connect to remote scripts, RSS feeds or use cURL on my website?

    The outgoing connections are disabled by default on all accounts for security reasons, however they can be enabled for paid accounts from Hosting Settings section. So all you need to do is go to your panel Hosting Settings section look for "Firewall Options" and click on the "Enable" button.

Re^2: get() from website hangs
by jcb (Parson) on Sep 14, 2019 at 21:40 UTC

    Free Web hosts generally restrict functions like that to avoid becoming havens for spammers and other Internet ne'er-do-wells. The reason that it is an option for paid accounts is probably because a paid account has a paper trail that (theoretically) gives the host someone to hold accountable for abuse.

    Crooks, of course, simply pay with stolen credit cards and move on to the next service when the payments bounce and the account is closed, but usually go straight for the "big" providers that are less likely to be able to keep close eyes on new accounts instead of abusing a paid tier on a free hosting service. At $WORK, I once had to watch the logs extra-closely around @DAYS of the month. That was when our worst abuse bots changed hosting providers like clockwork for several months in a row. Sending complaints was useless, because by the time the other provider acted on a complaint of a password-guessing bot, the account had usually been closed for using stolen payment details, or at least that was what the other abuse departments told us. I guess the miscreants eventually found easier targets or ran out of providers to abuse, but that wave lasted almost a year.