[PHP] CURL -d
I have this lines: curl -H Content-Type: application/json -d hello world \ http://api.pusherapp.com/apps/17331/channels/test_channel/events?\ The option -d is for data. But How I can set it on the PHP CURL extension? I have found that if I set something like array('Hello Word', 'name' = 'my_name'), for the POST data may occurs. Can you give me a little help? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CURL -d
On Mon, 2012-03-26 at 09:45 -0600, QI.VOLMAR QI wrote: I have this lines: curl -H Content-Type: application/json -d hello world \ http://api.pusherapp.com/apps/17331/channels/test_channel/events?\ The option -d is for data. But How I can set it on the PHP CURL extension? I have found that if I set something like array('Hello Word', 'name' = 'my_name'), for the POST data may occurs. Can you give me a little help? Have a look at curl_setopt() which can set those flags as you need inside PHP: http://uk3.php.net/manual/en/function.curl-setopt.php -- Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] CURL -d
I know guess that it is a POST field, but the detail is on simulate the -d without a label. I've already looked at setopt man page, but nothing seems like what I need. 2012/3/26 Ashley Sheridan a...@ashleysheridan.co.uk ** On Mon, 2012-03-26 at 09:45 -0600, QI.VOLMAR QI wrote: I have this lines: curl -H Content-Type: application/json -d hello world \ http://api.pusherapp.com/apps/17331/channels/test_channel/events?\ http://api.pusherapp.com/apps/17331/channels/test_channel/events?%5C%3E The option -d is for data. But How I can set it on the PHP CURL extension? I have found that if I set something like array('Hello Word', 'name' = 'my_name'), for the POST data may occurs. Can you give me a little help? Have a look at curl_setopt() which can set those flags as you need inside PHP: http://uk3.php.net/manual/en/function.curl-setopt.php -- Thanks, Ash http://www.ashleysheridan.co.uk
RES: [PHP] CURL -d
Hi try this : $ch = curl_init(); curl_setopt ( $ch, CURLOPT_URL, URL HERE ); curl_setopt ( $ch, CURLOPT_FOLLOWLOCATION, 1 ); curl_setopt ( $ch, CURLOPT_HEADER, 1 ); curl_setopt ( $ch, CURLOPT_TIMEOUT, 10); curl_setopt ( $ch, CURLOPT_SSL_VERIFYPEER, false ); curl_setopt ( $ch, CURLOPT_SSL_VERIFYHOST, false ); This to use SSL Certicade curl_setopt ( $ch, CURLOPT_SSLCERT, Public Key ); curl_setopt ( $ch, CURLOPT_SSLCERTPASSWD, ''); curl_setopt ( $ch, CURLOPT_SSLCERTTYPE, 'PEM' ); -- Type o certificade curl_setopt ( $ch, CURLOPT_SSLKEY, Private Key ); curl_setopt ( $ch, CURLOPT_SSLKEYPASSWD, Password of private key); curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 ); curl_setopt ( $ch, CURLOPT_POST, true ); curl_setopt ( $ch, CURLOPT_PORT , 443 ); -- port curl_setopt($ch, CURLOPT_POSTFIELDS, DATA HERE ); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'User-Agent: Some name', 'Accept-Encoding: gzip, deflate', 'POST some post data HTTP/1.1', 'Host: some host', 'Content-type: application/soap+xml; charset=utf-8', The content type 'Content-Length: ', length of data // This for soap action 'SOAPAction: action here ') ); $xResult = curl_exec($ch); Alejandro M.S. -Mensagem original- De: QI.VOLMAR QI [mailto:qi.vol...@gmail.com] Enviada em: segunda-feira, 26 de março de 2012 12:46 Para: PHP General Assunto: [PHP] CURL -d I have this lines: curl -H Content-Type: application/json -d hello world \ http://api.pusherapp.com/apps/17331/channels/test_channel/events?\ The option -d is for data. But How I can set it on the PHP CURL extension? I have found that if I set something like array('Hello Word', 'name' = 'my_name'), for the POST data may occurs. Can you give me a little help? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php