By Viyog

2016-05-07 03:43:36 8 Comments

I am getting following error when using PHP get_contents():

What am i missing here? It work perfectly in Local Server with XAMPP.

PHP Version 5.3.29

SSL Version OpenSSL/0.9.8b

Warning: file_get_contents() [function.file-get-contents]: SSL operation failed with code 1. OpenSSL Error messages: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure in /home/XXXXXX/public_html/test.php on line 21

Warning: file_get_contents() [function.file-get-contents]: Failed to enable crypto in /home/xxxxx/public_html/test.php on line 21

Warning: file_get_contents(https://.....XXXXXX) [function.file-get-contents]: failed to open stream: operation failed

$url_api        = "XXXXXXXXXXXXXX";

$getResult = array( 
"ssl" => array( 
    "verify_peer"      => false, 
    "verify_peer_name" => false, 
    'header'=>"XXXXXX: xxxxxxxxxx\r\n"  
$getContext = stream_context_create($getResult);
$getResponse = file_get_contents($url_api, false, $getContext);


@Shusen Yi 2018-04-23 03:53:54

Check your php.ini file, uncomment




If this already been done, check your firewall if it allows the connection. Simple way is to use telnet.

@Shusen Yi 2018-04-30 23:18:58

Viyog, Please check you the firewall from your host server to the server you want to open stream on. The firewall should be open on port 433 both way.

@Hristo Dinev 2016-05-07 04:53:27

I don't think that the problem is in your code. I tested it on my Laravel vagrant box and it worked perfectly. I think that the problem is in the data of your $url_api variable.

@Viyog 2016-05-07 11:31:50

I tested it in my local server and it is working just find but when i test in LIVE server it is throwing above error. I checked SSL and things all good there.

Related Questions

Sponsored Content

18 Answered Questions

[SOLVED] Reference — What does this symbol mean in PHP?

37 Answered Questions

[SOLVED] Deleting an element from an array in PHP

  • 2008-12-15 20:28:55
  • Ben
  • 2435489 View
  • 2351 Score
  • 37 Answer
  • Tags:   php arrays unset

28 Answered Questions

[SOLVED] How do I get PHP errors to display?

7 Answered Questions

[SOLVED] How does PHP 'foreach' actually work?

16 Answered Questions

[SOLVED] Why shouldn't I use mysql_* functions in PHP?

  • 2012-10-12 13:18:39
  • Madara Uchiha
  • 211563 View
  • 2428 Score
  • 16 Answer
  • Tags:   php mysql database

31 Answered Questions

[SOLVED] startsWith() and endsWith() functions in PHP

  • 2009-05-07 12:14:27
  • Click Upvote
  • 802534 View
  • 1399 Score
  • 31 Answer
  • Tags:   php string

28 Answered Questions

[SOLVED] How can I prevent SQL injection in PHP?

30 Answered Questions

[SOLVED] How do you parse and process HTML/XML in PHP?

1 Answered Questions

[SOLVED] facebook access token error

Sponsored Content