juliawalrus
New Member
Please need your help!I send a post using cURL but the response is blank (boolean false). If I post the data on browser like just pressing the \[code\]https://www.example.com/myaccount/transfer.php?username=usernamer&password=pass&deposit=5\[/code\] the browser shows the following result: \[quote\] \[code\]1 0 success Your account has been deposited\[/code\].\[/quote\]When I see the browser source code the results are:\[code\]<?xml version="1.0" encoding="utf-8"?><TransferResponse><version>1</version><result>0</result><resultstring>success</resultstring><description>Your account has been deposited</description></TransferResponse>\[/code\]Let me attach the my cURL code:\[code\]<?php$config = array("url" => "https://www.example.com/myaccount/","transfer" => "transfer.php","browser" => "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16");$postFields = "username=username&password=pass&deposit=5";$ch = curl_init();curl_setopt($ch, CURLOPT_URL, $config['url'] . $config['transfer']);curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);curl_setopt($ch, CURLOPT_CAINFO, getcwd() . "/cert/GeoTrustGlobalCA.crt");curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt");curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");curl_setopt($ch, CURLOPT_POST, 1);curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);curl_setopt($ch, CURLOPT_USERAGENT, $config['browser']);curl_setopt($ch, CURLOPT_REFERER, $config['url']);curl_setopt($ch, CURLOPT_HEADER, true);$content = curl_exec($ch);var_dump($content);var_dump(curl_getinfo($ch));curl_error($ch);curl_close($ch);echo $content;?>\[/code\]Please, assist me to get the result in cURL. I have tried many ways. I have surfed internet for 2 days straight. At last I decided to ask here. Can someone figure out what the problem is? The followings are done:
- Command line shows the result of \[code\]http\[/code\] (not https) as xml.
- Command line returns the result of \[code\]https\[/code\] (not http) follows: Failed: Error Number: 60. Reason: SSL certificate problem, verify that the CA cert is OK. Details:error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
- cURL result of \[code\]http\[/code\] (not https) just redirects warning page of www.example.com
- \[code\]var_dump($content); and var_dump(curl_getinfo($ch));\[/code\] results are:boolean falsearray (size=26) 'url' => string 'https://www.example.com/myaccount/transfer.php' (length=46) 'content_type' => null 'http_code' => int 0 'header_size' => int 0 'request_size' => int 0 'filetime' => int -1 'ssl_verify_result' => int 0 'redirect_count' => int 0 'total_time' => float 1.451 'namelookup_time' => float 0 'connect_time' => float 0 'pretransfer_time' => float 0 'size_upload' => float 0 'size_download' => float 0 'speed_download' => float 0 'speed_upload' => float 0 'download_content_length' => float -1 'upload_content_length' => float -1 'starttransfer_time' => float 0 'redirect_time' => float 0 'certinfo' => array (size=0) empty 'primary_ip' => string '177.70.43.10' (length=11) 'primary_port' => int 443 'local_ip' => string '192.168.11.9' (length=0) 'local_port' => int 0 'redirect_url' => string '' (length=0)