Jump to content

Problem always timing out


php_joe

Recommended Posts

I just tested grabbing that site and it works fine, it may be a problem with your server being able to reach that site..

 

I'd recommend using CURL for this as it requests the page with headers instead of physically gets the page contents.

Link to comment
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

Link to comment
Share on other sites

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..

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.