php - Unable to post query string via CURL -
url working fine in browser after accepting exception , not working in curl.
my code follows :::
php code :
<?php $str1 = "https://50.60.70.80/servlet/api"; $url = $str1."?".$_server['query_string']; echo $url; $ch = curl_init(); curl_setopt($ch, curlopt_url,$url); curl_setopt($ch, curlopt_ssl_verifypeer, false); curl_setopt( $ch , curlopt_ssl_verifyhost, true); $data = curl_exec($ch); echo curl_errno($ch); if (curl_errno($ch)) { echo 'error: ' . curl_error($ch); } else { echo 'success: '.$data; } curl_close($ch); ?> url : https://50.60.70.80/servlet/api?username=test&password=pwd&message=my_message&mobile=5555558888 error getting while using through command line "-k" , "-v": ***** connect() 50.60.70.80 port 443 (#0) * trying 50.60.70.80... connected * connected 50.60.70.80 (50.60.70.80) port 443 (#0) * initializing nss certpath: sql:/etc/pki/nssdb * warning: ignoring value of ssl.verifyhost * skipping ssl peer certificate verification * ssl connection using tls_dhm_rsa_w1th_aes_128_cbc_sea * server certificate: * subject: e=abcd@mnmn.com,ou=lelna,o=teledna * start date: mar 01 09:51:25 2013 gmt * expire date: mar 01 09:51:25 2014 gmt * common name: (nil) * issuer: e=abcd@mnmn.com,ou=lelna,o=teledna > /servlet/api?username=test http/1.1 > user-agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 nss/3.14.3.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2 > host: 50.60.70.80 > accept: */* > < http/1.1 200 ok < server: apache-coyote/1.1 < pragma: no-cache < cache-control: no-store < expires: thu, 01 jan 1970 00:00:00 gmt < transfer-encoding: chunked < date: thu, 08 aug 2013 16:38:57 gmt < status=failed,transid=4526698561,reasoncode=201 * connection #0 host 50.60.70.80 left intact * closing connection #0**** can ?
i using following versions :: php version -- 5.3.3 curl version -- 7.19.7 using apache
you need add this
edited :
curl_setopt( $ch ,curlopt_returntransfer,1); curl_setopt($ch, curlopt_customrequest, 'get');
Comments
Post a Comment