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"
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
|
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.