pastebin - collaborative debugging tool
kpaste.net RSS


Untitled
Posted by Anonymous on Sun 13th Apr 2014 05:23
raw | new post
view followups (newest first): Untitled by Anonymous

  1. <?php
  2. $handle = fopen("postcodes.txt", "r");
  3. if ($handle) {
  4.     while (($postcode = fgets($handle)) !== false) {
  5.         $postcode = trim($postcode);
  6.         if (empty($postcode)) continue;
  7.                 $ch = curl_init();
  8.                 $url = "http://www.dslchecker.bt.com/pls/adsl/ADSLChecker.AddressOutput?URL=&SP_NAME=a%20service%20provider&postcode=$postcode&VERSION=29&MS=E&CAP=yes&AEA=N";
  9.                 curl_setopt($ch, CURLOPT_URL, $url);
  10.                 curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  11.                 $result = curl_exec($ch);
  12.                 curl_close ($ch);
  13.                
  14.                 $dom = new DOMDocument();
  15.                 @$dom->loadHTML($result);
  16.                 $finder = new DomXPath($dom);
  17.                 $nodes = $finder->query("//option");
  18.                
  19.                 foreach ($nodes as $node) {
  20.                 echo $node->nodeValue."\r\n";
  21.         }
  22.         }
  23. }
  24.  
  25. ?>

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at