Jump to content

curl_setopt_array


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 post
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 post
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 post
Share on other sites
This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.