Xml-rpc response 302



I use this function for XML-RPC call to one wordpress page:



function send_request($requestname, $params){
$request = xmlrpc_encode_request($requestname, $params);
$ch = curl_init();
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
curl_setopt($ch, CURLOPT_URL, 'http://ift.tt/1iacPng');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$results = curl_exec($ch);
curl_close($ch);
return $results;
}

$params = array(0 => 1, 1 => 'username', 2 => 'password');
$response = send_request('wp.getPosts',$params);
var_dump($response);


In $response I get this:



<html>
<head>
<title>302 Found</title>
</head>
<body>
<h1>Found</h1>
<p>The document has moved <a href="/mod_sec.html">here</a>.</p>
</body>
</html>


And this link to "mod_sec.html" is not working, I am getting 404 found.


Then I added curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); in my function to follow redirect and now I am getting this (here is prt sc):


http://ift.tt/1oEk3wz


And when I visit this url: "http://ift.tt/1iacPng" from browser I doesn't redict me.


Does any one have some idea what is problem here?


No comments:

Post a Comment