0

Im using DomDoc to pull a page but because my server is in the US it pulls the US page and not the UK page.

Is there away to trick it into pulling the UK based page??

<?php

//above will be pulingthe race data

$pagecode = "1.119512711";


$url         = "http://form.timeform.betfair.com/racecard?id=".$pagecode; //WILL NEED TO PULL TOMORROWS DATE AS DD-MM-YYY

   echo $html        = file_get_contents($url);
    $dom         = new DOMDocument();
    @$dom->loadHTML($html);
    $dom->preserveWhiteSpace = false;
    $xpath                   = new DOMXPath($dom);
    //pull the individual cards for the day
    //li class="rac-cardsclass="ix ixc"

    $getdropdown             = '//ul[contains(@class, "runner-body-container")]/li/div/ul';
    $getdropdown2            = $xpath->query($getdropdown);
    //loop through each individual card
    foreach ($getdropdown2 as $dropresults) {



 $repl = preg_replace('/\h*[^ a-zA-Z].*$/m', '', trim($dropresults->childNodes->item(8)->textContent))."<br />";



     $dropresults->childNodes->item(18)->textContent."<br />";
     $dropresults->childNodes->item(20)->textContent."<br />";


}
?>
emma perkins
  • 749
  • 1
  • 10
  • 28

1 Answers1

0

Try using an server in the UK. You can also use an proxy to receive the file from the location of the proxy.

Proxy method: see this question on StackOverflow to see how to: file_get_contents behind a proxy?

Community
  • 1
  • 1
Rick Bakker
  • 76
  • 1
  • 7