ugrás a tartalomhoz

Https Curl-en keresztül nem megy, miért?

forumferenc · 2012. Szep. 25. (K), 13.27
Sziasztok!
Php-vel curl-en keresztül küldök adatokat de nem történik semmi. Mit rontok el?

Kódom:
  1. $post=array("auth_username"=>"felhasznalonevem","auth_password"=>"jelszavam");  
  2.     function httpsPost($url$data)  
  3.     {   
  4.   
  5.         $ch = curl_init();   
  6.         curl_setopt($ch, CURLOPT_URL, $url);  
  7.         curl_setopt($ch, CURLOPT_POST, 1);  
  8.         curl_setopt($ch, CURLOPT_POSTFIELDS, $data);  
  9.         curl_setopt($ch, CURLOPT_VERBOSE, 0);  
  10.         curl_setopt($ch, CURLOPT_HEADER, 0);  
  11.         curl_setopt($ch, CURLOPT_TIMEOUT, CURL_UTIL_CURL_TIMEOUT);  
  12.         curl_setopt($ch, CURLOPT_USERAGENT, CURL_UTIL_CURL_USERAGENT);  
  13.         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);  
  14.         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);  
  15.         curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);  
  16.         curl_setopt($ch, CURLOPT_CAINFO, getcwd() . "tanusitvany.crt");  
  17.        
  18.         return $content = curl_exec($ch);  
  19.         curl_close ($ch);  
  20.   
  21.     }   
  22.   
  23.   echo httpsPost("https://valami.hu/index.php"$post);  
Köszönöm
 
1

Hiba?

T.G · 2012. Szep. 25. (K), 13.54
Valami hibaüzenet?
http://hu.php.net/curl_error
2

SSL certificate

janoszen · 2012. Szep. 25. (K), 13.58
Ahhoz, hogy HTTPS oldalakat tudj lekerni, a Curlnek kell adni egy listat a megbizhato tanusitvany alairokrol (Certificate Authority). Ezt latom, meg is tetted, viszont a file formatumat erdemes ellenorizni, hogy valoban PEM formatumban vannak-e. Egy jo formatumu, alkalmas CA bundlet itt talalsz: http://curl.haxx.se/ca/cacert.pem

Alternativakent a CURLOPT_SSL_VERIFYPEER opciot false-ra allithatod, de ezt nem ajanlom.