SecondCity Posted April 12, 2017 Share Posted April 12, 2017 I was reading a tutorial that explained this... curl_setopt_array($ch, array( CURLOPT_URL => $url , CURLOPT_RETURNTRANSFER => 1, CURLOPT_CONNECTTIMEOUT => $timeout , )); Is there a way to adapt these lines so I can use them in the above function? curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/xml')); curl_setopt($ch, CURLOPT_POSTFIELDS, $xml->asXML()); Link to comment Share on other sites More sharing options...
requinix Posted April 12, 2017 Share Posted April 12, 2017 Yes. Read at the code, think about it, and give it a shot. Really, it should be fairly obvious after a couple seconds of looking at it. Link to comment Share on other sites More sharing options...
SecondCity Posted April 12, 2017 Author Share Posted April 12, 2017 I was reading a tutorial that explained this... curl_setopt_array($ch, array( CURLOPT_URL => $url , CURLOPT_RETURNTRANSFER => 1, CURLOPT_CONNECTTIMEOUT => $timeout , )); Is there a way to adapt these lines so I can use them in the above function? curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/xml')); curl_setopt($ch, CURLOPT_POSTFIELDS, $xml->asXML()); Obviously I could try this, but it seems like it will fail... curl_setopt_array($ch, array( CURLOPT_URL => $url , CURLOPT_RETURNTRANSFER => 1, CURLOPT_CONNECTTIMEOUT => $timeout , CURLOPT_HTTPHEADER => array('Content-Type: application/xml') CURLOPT_POSTFIELDS => $xml->asXML() )); I guess I worry that you can't use a => with an array or $xml->asXML() Link to comment Share on other sites More sharing options...
requinix Posted April 12, 2017 Share Posted April 12, 2017 Try it. Link to comment Share on other sites More sharing options...
SecondCity Posted April 13, 2017 Author Share Posted April 13, 2017 Try it. I looked in the PHP manual and have no clue what this does, so I don't know how to tell if using the array code would break it or not? CURLOPT_HTTPHEADER => array('Content-Type: application/xml') Link to comment Share on other sites More sharing options...
requinix Posted April 13, 2017 Share Posted April 13, 2017 T r y _ i t . Also, http://php.net/manual/en/function.curl-setopt.php CURLOPT_HTTPHEADER An array of HTTP header fields to set, in the format array('Content-type: text/plain', 'Content-length: 100') Link to comment Share on other sites More sharing options...
NotionCommotion Posted April 16, 2017 Share Posted April 16, 2017 @SecondCity Did it work? Link to comment Share on other sites More sharing options...
SecondCity Posted April 16, 2017 Author Share Posted April 16, 2017 @SecondCity Did it work? I have been so busy defending myself against Jacques1 in another thread, I forgot all about this one! Am working on another problem now, but when I finish that I will try this out and get back to you. Thanks for the reminder! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.