Ben düzenli kodlanmış URL sorgu dizesi ile EC2 Sorgu API basit bir GET isteğini yapmak gerekir. Protokol HTTPS olduğunu. Nasıl PHP'nin cURL yardımıyla isteği göndermek istiyorsunuz.
Örnek:
$url = "https://example.com";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
$result = curl_exec($ch);
curl_close($ch);
print_r($result);
CURLOPT_SSL_VERIFYPEER
Akran sertifikası geçerli veya süresi dolmuş / geçersiz olup olmadığını kontrol edin.
CURLOPT_SSL_VERIFYHOST alıntı php manual:
1 to check the existence of a common name in the SSL peer certificate. 2 to check the existence of a common name and also verify that it matches the hostname provided.
Eğer körü körüne sertifikayı kabul etmek CURL yapılandırmak istiyorsanız false CURLOPT_SSL_VERIFYPEER seçeneğini ayarlayabilirsiniz.
$url = 'https://www.example.com/abc';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Blindly accept the certificate
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($ch);
curl_close($ch);
var_dump($response);
PHP kodu açısından, kendisi tarafından sert bir HTTPS URL'ye, kıvrılma yoluyla bir isteği değil gönderiliyor.
Böyle bir şey gayet do (I just tried this portion of code on my machine, Windows, PHP 5.3) olmalıdır:
$url = 'https://.../...';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
curl_close($ch);
echo $data;
Ve gayet iyi sonuç verir: https://
URL erişmeye çalışırken benim tarayıcıda olsun aynı şeyi; CSS hariç, tabii ki.
You might want to take a look at the manual page of the curl_setopt
function : there are a lot of options, and some of those might be useful, in your specific case :-)
Burada, CURLOPT_SSL_VERIFYPEER
ve CURLOPT_SSL_VERIFYHOST
el; emin değil Amazon ile bu gerekir, ama başka bu kod kısmı işe yaramadı, bunları kullanmak zorunda - ama ben kullanıyorum sertifika kendinden imzalı olması ile ilgili olabilir ... ile ve bu olmadan deneyin ve bunları gerekirse hızlı bir şekilde bulacaksınız.
Ayrıca, bu görev ile yardımcı olmak için Zend Framework ve cURL adaptörü kullanabilirsiniz. Detaylar here