xml - CURL post via PHP -


hi need make curl request via php passing xml post have no idea how have idea ?

what 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); 

remove login $url , add curl:

curl_setopt($ch, curlopt_httpauth, curlauth_any); curl_setopt($ch, curlopt_userpwd, "login:token"); 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -