Jump to content

curl_setopt_array


SecondCity

Recommended Posts

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

 

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

@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

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.