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()); Quote 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. Quote 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() Quote Link to comment Share on other sites More sharing options...
requinix Posted April 12, 2017 Share Posted April 12, 2017 Try it. Quote 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') Quote 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') Quote Link to comment Share on other sites More sharing options...
NotionCommotion Posted April 16, 2017 Share Posted April 16, 2017 @SecondCity Did it work? Quote 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! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.