Jump to content

Regarding curl


sm

Getting Error as BAD Request  

  1. 1. Getting Error as BAD Request

    • php curl error
      0
    • curl php
      0


Recommended Posts

 Hai ,

 

     I'm trying to get xml data from another server.Here is the code i uSed. It's working fine in local but getting php output as "BAD REQUEST" when I upload in my server.

 

 

$ip = $HTTP_SERVER_VARS["REMOTE_ADDR"];

 

 

function send($url1, $data1) {

 

    $header = array ("POST /XML/XMLSearch HTTP/1.1","Content-Type: text/xml");

              //Set up the CURL.....

              $ch = curl_init($url1);

             curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

             curl_setopt($ch, CURLOPT_HTTPHEADER, $header);

            // curl_setopt($ch, CURLOPT_POSTFIELDS, $data1);

            $result1 = curl_exec($ch);

            curl_close ($ch);    

       

         return $result1;

}

 

 

 

 

$content='YJzQxX6l&l=&i=0&n=2&tl=2&ip=$ip&lf=0&af=1&cat=health insurance';

 

$url="http://api.ingenio.com/YJzQxX6l/GetListings.asmx/lq?a=YJzQxX6l&l=&i=0&n=2&tl=2&ip=$ip&lf=0&af=1&cat=health insurance";

$response_content=send($url,$content);

print $response_content;

 

 

 

Any soiution is appreciated

Thanks in advance.

Link to comment
https://forums.phpfreaks.com/topic/102094-regarding-curl/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.