Jump to content

Cross Domain Proxy : Blank XML returned when url contains space


Recommended Posts

Hi All,

 

      I am using a proxy to retrieve data (in xml format) from a remote server. Depending on a search string, a url is formed : for example, if search string is "hello all", then the url will be :

'http://songbuzz.rediff.com/search/hello all?output=xml'

 

when this search string is a single string, i am getting proper xml data...but when there are multiple strings, most of the time I am not getting any result - A blank response.

 

Following is my proxy code:

 

// The actual form action
$action = $_REQUEST['url'];

// Initiate cURL
$ch = curl_init();

// Do we need to POST of GET ?
if (strtoupper($method) == 'POST')
{
curl_setopt($ch, CURLOPT_URL, $action);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);  [i am not using the field attribute]
}
else
{
curl_setopt($ch, CURLOPT_URL, $action);
}

// Follow redirects and return the transfer
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);

// Get result and close cURL
$result = curl_exec($ch);
curl_close($ch);

// Return the response
header('Content-Type: text/xml'); 
echo $result;

 

 

I tried several other proxies (open source available) but the same thing is happening.

Can you tell me where am I going wrong?

 

 

Thanks,

Swarnendu

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.