Plugin Directory

Changeset 539475


Ignore:
Timestamp:
05/03/2012 03:07:16 PM (14 years ago)
Author:
createyourleague
Message:

fixed url wrapper?

Location:
create-a-league
Files:
2 edited
3 copied

Legend:

Unmodified
Added
Removed
  • create-a-league/tags/1.0/create-your-league.php

    r483272 r539475  
    33Plugin Name: Create Your League
    44Plugin URI: http://www.createyourleague.com/
    5 Version: 0.5
     5Version: 1.0
    66Author: createyourleague, http://www.risultatieclassifiche.net/
    77Author URI: http://www.risultatieclassifiche.net/
     
    2424    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    2525*/
     26
     27function createyourleague_get_remote_file($url)
     28{
     29   // get the host name and url path
     30   $parsedUrl = parse_url($url);
     31   $host = $parsedUrl['host'];
     32   if (isset($parsedUrl['path'])) {
     33      $path = $parsedUrl['path'];
     34   } else {
     35      // the url is pointing to the host like http://www.mysite.com
     36      $path = '/';
     37   }
     38
     39   if (isset($parsedUrl['query'])) {
     40      $path .= '?' . $parsedUrl['query'];
     41   }
     42
     43   if (isset($parsedUrl['port'])) {
     44      $port = $parsedUrl['port'];
     45   } else {
     46      // most sites use port 80
     47      $port = '80';
     48   }
     49
     50   $timeout = 20;
     51   $response = '';
     52
     53   $referer = (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
     54
     55   // connect to the remote server
     56   $fp = fsockopen($host, $port, $errno, $errstr, $timeout);
     57
     58   if( !$fp ) {
     59      echo "Cannot retrieve $url";
     60   } else {
     61      // send the necessary headers to get the file
     62      fputs($fp, "GET $path HTTP/1.0\r\n" .
     63                 "Host: $host\r\n" .
     64                 "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3\r\n" .
     65                 "Referer: $referer\r\n\r\n");
     66
     67      // retrieve the response from the remote server
     68      while ($line = fread($fp, 4096)) {
     69         $response .= $line;
     70      }
     71
     72      fclose($fp);
     73
     74      // strip the headers
     75      $pos      = strpos($response, "\r\n\r\n");
     76      $response = substr($response, $pos + 4);
     77   }
     78
     79   // return the file content
     80   return $response;
     81}
    2682
    2783function createyourleague_context() {
     
    48104    $host = createyourleague_host($lang);
    49105
    50     return file_get_contents('http://' . $host . '/api/php/' . $id, false, createyourleague_context());
     106    return createyourleague_get_remote_file('http://' . $host . '/api/php/' . $id);
    51107}
    52108
     
    61117    $host = createyourleague_host($lang);
    62118
    63     return file_get_contents('http://' . $host . '/api/php-days/' . $id . '?order=' . urlencode($order) . '&limit=' . urlencode($limit) . '&day=' . urlencode($day) . '&two_columns=' . urlencode($two_columns), false, createyourleague_context());
     119    return createyourleague_get_remote_file('http://' . $host . '/api/php-days/' . $id . '?order=' . urlencode($order) . '&limit=' . urlencode($limit) . '&day=' . urlencode($day) . '&two_columns=' . urlencode($two_columns));
    64120}
    65121
     
    69125    $host = createyourleague_host($lang);
    70126
    71     return file_get_contents('http://' . $host . '/api/php-topscorers/' . $id, false, createyourleague_context());
     127    return createyourleague_get_remote_file('http://' . $host . '/api/php-topscorers/');
    72128}
    73129
  • create-a-league/tags/1.0/readme.txt

    r483272 r539475  
    55Requires at least: 2.5
    66Tested up to: 3.3
    7 Stable tag: 0.5
     7Stable tag: 1.0
    88
    99Create Your League is a completely FREE service that allows you to publish the ranking table of your league directly to your WordPress web site.
     
    6565== Changelog ==
    6666
     67= 1.0 =
     68* fixed error when php setting allow_fopen_url is off
     69
    6770= 0.4 =
    6871* added new parameters to createyourleague_days
  • create-a-league/trunk/create-your-league.php

    r483272 r539475  
    33Plugin Name: Create Your League
    44Plugin URI: http://www.createyourleague.com/
    5 Version: 0.5
     5Version: 1.0
    66Author: createyourleague, http://www.risultatieclassifiche.net/
    77Author URI: http://www.risultatieclassifiche.net/
     
    2424    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    2525*/
     26
     27function createyourleague_get_remote_file($url)
     28{
     29   // get the host name and url path
     30   $parsedUrl = parse_url($url);
     31   $host = $parsedUrl['host'];
     32   if (isset($parsedUrl['path'])) {
     33      $path = $parsedUrl['path'];
     34   } else {
     35      // the url is pointing to the host like http://www.mysite.com
     36      $path = '/';
     37   }
     38
     39   if (isset($parsedUrl['query'])) {
     40      $path .= '?' . $parsedUrl['query'];
     41   }
     42
     43   if (isset($parsedUrl['port'])) {
     44      $port = $parsedUrl['port'];
     45   } else {
     46      // most sites use port 80
     47      $port = '80';
     48   }
     49
     50   $timeout = 20;
     51   $response = '';
     52
     53   $referer = (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
     54
     55   // connect to the remote server
     56   $fp = fsockopen($host, $port, $errno, $errstr, $timeout);
     57
     58   if( !$fp ) {
     59      echo "Cannot retrieve $url";
     60   } else {
     61      // send the necessary headers to get the file
     62      fputs($fp, "GET $path HTTP/1.0\r\n" .
     63                 "Host: $host\r\n" .
     64                 "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3\r\n" .
     65                 "Referer: $referer\r\n\r\n");
     66
     67      // retrieve the response from the remote server
     68      while ($line = fread($fp, 4096)) {
     69         $response .= $line;
     70      }
     71
     72      fclose($fp);
     73
     74      // strip the headers
     75      $pos      = strpos($response, "\r\n\r\n");
     76      $response = substr($response, $pos + 4);
     77   }
     78
     79   // return the file content
     80   return $response;
     81}
    2682
    2783function createyourleague_context() {
     
    48104    $host = createyourleague_host($lang);
    49105
    50     return file_get_contents('http://' . $host . '/api/php/' . $id, false, createyourleague_context());
     106    return createyourleague_get_remote_file('http://' . $host . '/api/php/' . $id);
    51107}
    52108
     
    61117    $host = createyourleague_host($lang);
    62118
    63     return file_get_contents('http://' . $host . '/api/php-days/' . $id . '?order=' . urlencode($order) . '&limit=' . urlencode($limit) . '&day=' . urlencode($day) . '&two_columns=' . urlencode($two_columns), false, createyourleague_context());
     119    return createyourleague_get_remote_file('http://' . $host . '/api/php-days/' . $id . '?order=' . urlencode($order) . '&limit=' . urlencode($limit) . '&day=' . urlencode($day) . '&two_columns=' . urlencode($two_columns));
    64120}
    65121
     
    69125    $host = createyourleague_host($lang);
    70126
    71     return file_get_contents('http://' . $host . '/api/php-topscorers/' . $id, false, createyourleague_context());
     127    return createyourleague_get_remote_file('http://' . $host . '/api/php-topscorers/');
    72128}
    73129
  • create-a-league/trunk/readme.txt

    r483272 r539475  
    55Requires at least: 2.5
    66Tested up to: 3.3
    7 Stable tag: 0.5
     7Stable tag: 1.0
    88
    99Create Your League is a completely FREE service that allows you to publish the ranking table of your league directly to your WordPress web site.
     
    6565== Changelog ==
    6666
     67= 1.0 =
     68* fixed error when php setting allow_fopen_url is off
     69
    6770= 0.4 =
    6871* added new parameters to createyourleague_days
Note: See TracChangeset for help on using the changeset viewer.