XML : CURL post via PHP

Hi i need to make a curl Request via PHP passing a XML by POST but I have no idea how to do that anyone have any idea ?

what i have right now

  $xml = '<project>              ...              </project>';        $url = 'http://login:token@localhost:8080/createItem?name=newjobname';      $fields = array(          'name' => urlencode('newjobname'),      );        $fields_string = 'name=newjobname';        $ch = curl_init();        curl_setopt($ch,CURLOPT_URL, $url);      curl_setopt($ch, CURLOPT_POSTFIELDS, "xmlRequest=" . $xml);      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);      curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 300);      $result = curl_exec($ch);        curl_close($ch);    

No comments:

Post a Comment