Page 1 of 1

File Get contents not working - any ideas why?

Posted: Sat Apr 02, 2016 11:39 am
by simonmlewis
We have a really bad problem that is affecting multiple websites.

Perhaps someone can shed light on it.

http://www.remoteprice.com/data.asp?sto ... M27&type=2
If you visit this URL, it probably open a page with two lines of code, one that says 68 I think.

But if you put this into html/php:

Code: Select all

<?php
$romanstock = "http://www.remoteprice.com/data.asp?storeid=44175&itemcode=M27&type=2";
      $contentsstock = file_get_contents($romanstock);
      preg_match('/var cText = \'([0-9]+)\'/', $contentsstock, $matches);
      echo "$matches[1]";
      echo "$contentstock";
            ?>
It should show the result on screen. But doesn't. At the moment we think it could be down to the servers it is passing through, but when someone checks the URL on it's own and that works, we dont know why the file_get_contents doesn't.

Could one of the companies in the route of data, be blocking it ???
The companies are Cloudflare and Claranet.

Re: File Get contents not working - any ideas why?

Posted: Sat Apr 02, 2016 3:59 pm
by Celauran
Works fine for me. What do you get if you var_dump($contentsstock)?