Jump to content

Problem always timing out


php_joe

Recommended Posts

Hi,

 

I'm having problems getting information from a website. Whatever I do times out.

 

Even a simple code like this:

 

<?php
echo file_get_contents("http://shop.darkswords.ru");
?>

 

Here is the address:

http://shop.darkswords.ru

 

I can't figure out what's wrong.

 

Thanks!

 

Joe

 

Link to comment
https://forums.phpfreaks.com/topic/172350-problem-always-timing-out/
Share on other sites

I was trying CURL originally, because I wanted to log in and submit an action. It timed out, so I tried file_get_contents() as a test, and it timed out too.

 

file_get_contents() works fine for every other site that I've tried it on.

 

The error code I'm getting says this:

 

Warning: file_get_contents(http://shop.darkswords.ru) [function.file-get-contents]: failed to open stream: Connection timed out in /hsphere/local/home/mysite.com/testfile.php on line 2

 

I'm wondering if it has something to do with the encoding. The site was written and hosted in Russia, and the comments are in Russian.

 

Could there be some kind of (human) language-based incompatibility?

 

Joe

I'm not sure the encoding would mess with it. If you're really wanting to fix that, if that is the problem.. try..

$html = utf8_encode(file_get_contents('www.example.com'));

And that should fix the encodings as it's coming along..

 

But how about you jack the max execution time via php.ini or .htaccess? You can finally debug how long it is taking, or if it is NOT connecting at all to that server. CURL would be a better option as you can define ports and change the connection timeout variable, you can tinker to see how long it really takes..

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.