Forum Archive - php file_get_contents() usage

php file_get_contents() usage
Apr 10, 2014 7:17 pm by casinobonus
Hi. I think this issue is related to a old one posted, but I will try to explain from the beginning. I need to use the following code in a page on my main (no-translated) domain casinobonuscenter.com: <?php $desc_esp = file_get_contents("http://es.casinobonuscenter.com/dsctranslate.php?linkid=44"); echo $desc_esp; ?> to read and show some content from a translated page (served by gtranslate). This code is yet on the following url: http://casinobonuscenter.com/traduc-cron/getfile.php As you can see, I can't read the content of the translated page. My hosting provider is telling me as follow: ====Start quote http://casinobonuscenter.com/traduc-cron/getfile.php is not accessible from your VPS because they have firewall, blocking the connection: bash-4.1# wget http://es.casinobonuscenter.com/dsctran ... ?linkid=44 --2014-04-10 16:36:23-- http://es.casinobonuscenter.com/dsctran ... ?linkid=44 Resolving es.casinobonuscenter.com... 94.23.220.123 Connecting to es.casinobonuscenter.com|94.23.220.123|:80... failed: Connection timed out. Retrying. bash-4.1# traceroute -n 94.23.220.123 traceroute to 94.23.220.123 (94.23.220.123), 30 hops max, 60 byte packets 1 46.249.204.186 0.090 ms 0.009 ms 0.008 ms 2 193.29.223.69 1.367 ms 1.537 ms 1.636 ms 3 141.136.98.21 1.088 ms 1.103 ms 1.098 ms 4 141.136.99.74 1.090 ms 1.070 ms 1.069 ms 5 * * * 6 94.23.122.66 5.745 ms 5.889 ms 5.949 ms 7 94.23.122.173 5.346 ms * * 8 * * * 9 * * * 10 * * * 11 * * * 12 * * * 13 * * * 14 * * * 15 * * * 16 * * * 17 * * * 18 * * * 19 * * * 20 * * * 21 * * * 22 * * * 23 * * * 24 * * * 25 * * * 26 * * * 27 * * * 28 * * * 29 * * * 30 * * * ====End quote So, basically he is directing me to the same point explained on my old topic on this forum. I know you don't have firewalls or blocking the IP, but do you have a possible solution or suggestion?
Re: php file_get_contents() usage
Apr 11, 2014 12:32 pm by Edvard
Hi, I would suggest to place your script on a different server and modify your current script to call the script on the other server which will get the needed data. If your purpose is to setup a cron script which will access translated pages to make the translation process faster, then just set it up on a different server. Also, make sure that you won't send too many requests to our server and overload it if you don't want to get blocked by our system. Thanks!
Re: php file_get_contents() usage
Apr 11, 2014 1:14 pm by casinobonus
Thank you. Yes, I like to use cron to access some translated text faster. I will use this for about 400 pages (text only) all similar to this one: http://es.casinobonuscenter.com/dsctran ... ?linkid=35 and for 4 languages, so I will request about 1600 pages. But this will be only once because after that I will check every 12 hours and I will request only modified pages...
Re: php file_get_contents() usage
Apr 11, 2014 1:28 pm by Edvard
You need to make sure that you do less than 10 requests per second. Thanks!

SIMILAR TOPICS

Is there any usage statistics for selected languages?Apr 7, 2016 8:29 pmReplies: 9Post by: lesufomu
High CPU UsageFeb 1, 2015 9:35 amReplies: 13Post by: xbonize
Disk space usage explode!Feb 20, 2015 8:27 amReplies: 1Post by: nandasatria
files and CPU usage too highJan 26, 2015 6:57 amReplies: 3Post by: ricardo
Cache problems (20gb usage)Sep 29, 2011 11:25 amReplies: 7Post by: pr1970

Try GTranslate with a free 15 day trial