Beyaz boşluk sorun php proxy kullanarak iken

1 Cevap php

Benim URL zaten kodlanmış ve ben% 20 sonra herhangi bir metni bir kere bozuk bir istek hatası alıyorum sahip tutmak ile ben bir php web proxy kullanarak ediyorum. Neden herhangi bir fikir oluyor ki? I istimal web proxy kodu ben yahoo hizmetlerinden aldı sadece bir örnek:

<?php
// PHP Proxy example for Yahoo! Web services. 
// Responds to both HTTP GET and POST requests
//
// Author: Jason Levitt
// December 7th, 2005
//

// Allowed hostname (api.local and api.travel are also possible here)
define ('HOSTNAME', 'http://search.yahooapis.com/');

// Get the REST call path from the AJAX application
// Is it a POST or a GET?
$path = ($_POST['yws_path']) ? $_POST['yws_path'] : $_GET['yws_path'];
$url = HOSTNAME.$path;

// Open the Curl session
$session = curl_init($url);

// If it's a POST, put the POST data in the body
if ($_POST['yws_path']) {
 $postvars = '';
 while ($element = current($_POST)) {
  $postvars .= urlencode(key($_POST)).'='.urlencode($element).'&';
  next($_POST);
 }
 curl_setopt ($session, CURLOPT_POST, true);
 curl_setopt ($session, CURLOPT_POSTFIELDS, $postvars);
}

// Don't return HTTP headers. Do return the contents of the call
curl_setopt($session, CURLOPT_HEADER, false);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);

// Make the call
$xml = curl_exec($session);

// The web service returns XML. Set the Content-Type appropriately
//header("Content-Type: text/xml");

echo $xml;
curl_close($session);

?>

1 Cevap

Bu sorunu ben kodlamak gibi boşluk olarak url kodlama, gerekebilir karakterler içerdiği benim url parametresi url için gerekli olduğu ortaya çıktı. Yws_path bir değeri zaten url kodlu başlamıştı, ama ben bu vekil tarafından çözülür ve daha sonra http istek birlikte gönderilir almak olmalı düşünüyorum. Ben bir boşluk gerekli kısmını şifreleyen çift olmadan, benim istek (aslında düzgün url değil kodlanmış bir http isteği ile sonuçlanan), sadece bir boşluk ile yerine% 20 ile birlikte geçti ama elde değildi.