Changeset 8090


Ignore:
Timestamp:
Dec 12, 2010, 11:16:12 AM (13 years ago)
Author:
patdenice
Message:

merge r8089 from branch 2.1 to trunk
feature 2057: use http_build_query instead of add_url_params for GET data.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/admin/include/functions.php

    r8084 r8090  
    17261726  $method  = empty($post_data) ? 'GET' : 'POST';
    17271727  $request = empty($post_data) ? '' : http_build_query($post_data, '', '&');
    1728   $src     = add_url_params($src, $get_data, '&');
     1728  if (!empty($get_data))
     1729  {
     1730    $src .= strpos($src, '?') === false ? '?' : '&';
     1731    $src .= http_build_query($get_data, '', '&');
     1732  }
    17291733
    17301734  // Initialize $dest
     
    17421746    {
    17431747      @curl_setopt($ch, CURLOPT_POST, 1);
    1744       @curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
     1748      @curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
    17451749    }
    17461750    $content = @curl_exec($ch);
     
    17661770      'http' => array(
    17671771        'method' => $method,
    1768         'content' => $request,
    17691772        'user_agent' => $user_agent,
    17701773      )
    17711774    );
     1775    if ($method == 'POST')
     1776    {
     1777      $opts['http']['content'] = $request;
     1778    }
    17721779    $context = @stream_context_create($opts);
    17731780    $content = @file_get_contents($src, false, $context);
     
    17921799  $http_request  = $method." ".$path." HTTP/1.0\r\n";
    17931800  $http_request .= "Host: ".$host."\r\n";
    1794   $http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n";
    1795   $http_request .= "Content-Length: ".strlen($request)."\r\n";
     1801  if ($method == 'POST')
     1802  {
     1803    $http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n";
     1804    $http_request .= "Content-Length: ".strlen($request)."\r\n";
     1805  }
    17961806  $http_request .= "User-Agent: ".$user_agent."\r\n";
    17971807  $http_request .= "Accept: */*\r\n";
Note: See TracChangeset for help on using the changeset viewer.