I am using NetworkRedux shared hosting and following the APNs setup instructions at http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12 then I get this:
Warning: stream_socket_client() [function.stream-socket-client]: unable to
connect to ssl://gateway.sandbox.push.apple.com:2195 (Connection timed out) in
FILEPATH on line 21
Failed to connect: 110 Connection timed out
It looks like they are blocking this, lame. Is there a may I can use my same script including my private key and everything to connect to a proxy that will connect to Apple? I am not interested in services that "do push for you" or web APIs or anything. I want a temporary fix that I can build off of and then remove when I migrate this to a real host, that doesn't block those ports.
Actually it is possible, but direct is the best way if possible in your environment. If you have to use an HTTP Proxy, then all you need to do is connect to the proxy, then create an HTTP Tunnel through the proxy to Apple's servers - don't initiate the TLS with Apple until after the proxy connection is create. Here is some good documentation on creating such a HTTP Tunnel with PHP: http://kakku.wordpress.com/2007/11/25/proxy-hacks-final-httptunnel-tcpip-connections-over-plain-old-get-and-post-requests/
Related
I followed this youtube tutorial on how to send push notifications: https://www.youtube.com/watch?v=_3YlqWWnI6s
When I run the php file on my webserver however it times out giving me this error. I have looked at the web and nothing I could find seems to be the problem, can someone suggest where I have gone wrong..
[14-Dec-2015 06:13:10 America/New_York] PHP Warning: stream_socket_client(): unable to connect to ssl://gateway.sandbox.push.apple.com:2195 (Connection timed out) in /home2/sptechno/public_html/Wink/sendPush.php on line 18
when you run .php file for Apple push notification.
That time you need to check the TCP/UDP Port number is open on your server other wise notification not pass to apple server.
General Provider Requirements
As a provider you communicate with Apple Push Notification service
over a binary interface. This interface is a high-speed, high-capacity
interface for providers; it uses a streaming TCP socket design in
conjunction with binary content. The binary interface is asynchronous.
The binary interface of the production environment is available
through gateway.push.apple.com, port 2195; the binary interface of the
development environment is available through
gateway.sandbox.push.apple.com, port 2195.
Apple official document for that.
EDITED
Check for your server is connected to APNS.
HOSTGATOR:~ Home$ telnet gateway.sandbox.push.apple.com 2195
Trying 17.149.34.143...
Connected to gateway.sandbox.push-apple.com.akadns.net.
Escape character is '^]'.
The question has already been asked on this forum but my concern in different. I have shared server space on Crazy domains and Blue Host. I have tried sending push notification with both of them. When i try it on Crazy Domain I get the following error:
Warning: stream_socket_client() [function.stream-socket-client]: unable to connect to ssl://gateway.sandbox.push.apple.com:2196 (Connection timed out) in /home4/karmamob/public_html/pushNotification/api.php on line 20
Failed to connect: 110 Connection timed out
When i run the same on Crazy Domain , I get the following error.
Warning: stream_socket_client() [function.stream-socket-client]: unable to connect to ssl://gateway.sandbox.push.apple.com:2196 (Connection timed out) in /home4/karmamob/public_html/pushNotification/api.php on line 20
Failed to connect: 110 Connection timed out
There should be no issues with the certificate because it runs fine on my local mac PC.
What i want to ask is, Can I solve this problem if I buy a Dedicated IP from BLUE HOST?
No you don't. Shared hosting plans tend to have controlled environments that you, as a shared user, can't really change, such as open or blocked ports. Is there any way you can check if connections through port 2196 are being successfully established (not necessarily to Apple)? Some low-cost, shared plans are known for blocking some juice in favour of stability and security. Also check if your push certs are properly uploaded. Cheers.
Yes, as NewObjective clarified, 2195 & 2196 ports have to be open. To open these ports you might ask Bluehost technical support team (ticket/chat), but you have to have dedicated IP address before that.
But there is another issue. If you try to send push notification message right after dedicated IP address is set and both ports are open you might receive the same "Connection timed out" error. You can test that problem by logging in to your server via SSH and running "telnet gateway.sandbox.push.apple.com 2195" command. If you receive "Connection timed out" error - you can try to contact Bluehost support team, but they can't solve this problem.
If you try to telnet any other server with 2195 opened port you will also receive that error. I had about 10 chats with Bluehost support team, opened 10 or so tickets, but they really couldn't help me. But two weeks later everything began to work. I think it was because turning dedicated IP on takes some time, but I'm not sure. Anyway, it very interesting that Bluehost support team always answers that the problem is on the Apple side, even if you tell them that any other server with 2195 opened port isn't available too)
I have a PHP based SFTP application I created and it has been working great. Now I have to put it on a server that has a firewall. I get this error:
Message: ssh2_connect(): php_network_getaddresses: getaddrinfo failed: Name or service not known
If I turn off the firewall it works fine. The firewall accepts:
ALL outbound ports.
All inbound 443 traffic, buts drops ALL other inbound traffic.
I read something about cURL needing port 9091 inbound open but that did not work.
I tried allowing all inbound port 22 (ssh) traffic but that did not work.
I tried allowing all inbound port 80 (http) traffic but still not working.
I tried using phpseclib instead of SSH2 PECL, but still get the same type of error.
Does anyone have any idea what inbound port has to be open?
Or have any ideas on what else might be going on?
I'm building an internal web-application in PHP that needs the ability to mail.
I've used the code listed here:
Send email using the GMail SMTP server from a PHP page
and it works like a charm, when I run it from my house. However, when I run the code from the office, I get the following:
Failed to connect to ssl://smtp.gmail.com:465 [SMTP: Failed to connect socket: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (code: -1, response: )]
Any idea how to get around this?
Thanks,
-JWW
I agree with the responder above - this is most likely a firewall blocking outbound connections on port 465. You can either try TLS connection on port 587 or port 25 per Gmail's troubleshooting docs : http://support.google.com/mail/bin/answer.py?hl=en&answer=78775
If you are unable to get around this (if IT will not remove the blocks for example), you could try a third party API as a proxy. Our product http://PostageApp.com can use external mailservers such as Gmail, in addition to our own MTA, and communication is all through standard http REST calls, avoiding the firewall issue.
We're a paid service but have a free plan as well...if you would be sending more email than our free plan allows for (100/day), then you'll probably fall foul of Gmail's sending limits anyway which restrict third party clients to about 100/day outbound.
http://help.postageapp.com/kb/quick-start-guides/php
Disclaimer: I work for PostageApp
It's most probably a firewall at your workplace blocking outgoing connections to port 465. Did you try port 587 instead?
I am using SMPP with PHP for sending and receiving messages. I got this error when i am
trying to send a message. what is the cause of this and how can i send a message ?
thanks.
pfsockopen() [function.pfsockopen]: unable to connect to sms.korewireless.com:2777 (A
connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. )
Your program tries to connect to remote server, but fails to do it before timeout elapsed.
There could be plenty of reasons for this: server may be not listening this port, your firewall forbids access to it and so on.
Try to connect to that server using telnet to find where problem is.
SMPP usually needs a bind into their server from yours. This could include whitelisting IP's, User/Pass, etc... I would contact their help desk as it sounds to be a configuration error either on your side or theirs.