Google Talk over XMPP - php

I am trying to establish a XMPP connection to talk.google.com on port 5222, however I am getting a 301 MOVED PERMANENTLY response redirecting me to hangouts.google.com.
I know Google abandoned GTalk, and what I could find is really inconclusive of whether the service is actually still up and running (although not maintained), or not.
I almost gave up thinking it is just not there anymore, however last try using external client (Adium...like Pidgin but for Mac) instead of my own library (XMPP-PHP), ended up actually connecting to the server and sending messages all fine.
Is there something I'm missing?

You want to do an DNS SRV record lookup to find the actual server to connect to, eg https://kingant.net/check_xmpp_dns/?h=gmail.com says that the client records for gmail.com's XMPP server are xmpp.l.google.com and alt{1..4}.xmpp.l.google.com
Alternatively, you could use a hangups-based solution to speak the native Hangouts protobuf format: https://github.com/tdryer/hangups/

I have found the right URL to be talk.l.google.com.

Related

"Connection Refused" via PHP cURL from GoDaddy Hosting to internally hosted Radarr server's API (jQuery works though?!)

I'm at a complete loss as to why this is failing, so get ready for the novel describing exactly what I'm trying to accomplish and what I've tested so far.
Goal:
I'm building a webpage on my GoDaddy hosting account that I want to connect to my locally hosted Radarr server's API via PHP cURL.
I want to use PHP so I can obfuscate the IP, port, and APIKey on the client side. Plus, some of Radarr's API calls I would like to use cannot be run via query string.
Problem:
No matter what I try, I am getting nothing but the following error:
Failed to connect to <MY PUBLIC IP ADDRESS> port <PORT NUMBER>: Connection refused
(And yes, this is the publicly opened port, not the internal port on the server.)
Setup:
I installed Radarr on a FreeNAS (11.3-U5) jail hosted in my home. This is working beautifully.
I setup the FreeNAS jail with a dedicated IP address instead of allowing it to NAT internally, just to make sure it doesn't cause any issues.
I configured port forwarding on my router to allow external traffic into the Radarr server. This is working. Note: Xfinity is my ISP, but I purchased the router separately.
I have a GoDaddy hosting account where I've written a webpage to tie into Radarr's API on my local network. Currently, the webpage is also working beautifully to query data from the API, BUT it's connecting to Radarr via $.getJSON with JavaScript and jQuery.
(Before anyone says it, yes, I know GoDaddy hosting isn't the best option, but it's the one I'm using.)
Testing:
I swear I've tested EVERYTHING and I don't know why this is failing.
This IS working through the JavaScript/jQuery solution, meaning the Radarr server is up and running, the port is properly forwarded through my router, and GoDaddy's hosting isn't blocking the connection.
I CAN access the raw JSON API response in the browser simply by entering the full API URL call.
And while I'd say I am versed in PHP, I'm certainly no expert, so I even tried pulling a generic PHP cURL script from another StackOverflow post, changing the URL to mine, and running that with no luck. Note: The original script DID work to connect to another external API though.
Then I tried Postman, which worked, and I used Postman to create a PHP script, but that script failed.
All of the functional testing done on my local network was done using my publicly facing IP address. However, just to be certain, I also tried reaching the API through the browser off my network, and that worked just fine.
In a desperate attempt, I also reached out to GoDaddy support to see if they had any ideas. They went as far as creating a test PHP cURL script in the same hosting directory and had it simply pull Google's homepage. That worked just fine.
After GoDaddy was unable to help, I setup a free hosting account and free subdomain on AwardSpace, uploaded the script, and that failed too.
In digging into the Connection Refused error, someone suggested just trying to ping the IP through PHP. I attempted this, but it returned 100% packet loss. Also, I logged into my router and watched the incoming connections as I tested. Using the jQuery solution, I saw the incoming connection and it worked great. Using the PHP solution, it didn't register anything inbound.
Lastly, I have confirmed that the publicly opened port on my router is in the list of blocked port by Xfinity. However, since I can access the server externally through the browser and via the jQuery script, that can't be the issue.
There seem to be many, many, many articles online about the general Connection Refused error, but I haven't found a solution to my problem from any of them.
Does anyone have any suggestions?

Can I change WebSocket from ws to wss? (000webhost)

I had built a website as a dashboard (using 000webhost) to change the data in mySQL database via php which was working fine right now. After that, I have a Unity WebGL build uploaded on itch.io which was working fine as well until it need to get data from the database via php. When I was intended to get the data via accessing php files store in the 000webhost server, I got the following error show up in the web console from the accessing website.
Mixed Content: The page at 'https://.itch.io/' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://:54998/'. This request has been blocked; this endpoint must be available over WSS
The link I was using to access the php files was using https instead of http. I am still new to these area, I would like to know can I change the WebSocket endpoint to wss instead of ws? Do I need a paid plan to solve this? I did saw that the Single Hosting plan did offer free SSL certificate. Please help me, I am open for any suggestion/advice, Thank You.
The Websocket Server itself need to setup the SSL Certificate. If it doesnt, you need a reverse proxy like nginx or apache to handle the SSL and forwarding to the unencrypted ws:// websocket.
Anyway, the websocket should run on default port 443/80 as well, since many firewalls are blocking non default ports for security reasons. In this case you will need the reverseproxy if you dont have a dedicated IP for the websocket server.
Use socket.io. Most of the problems are solved and there is no need to do more.
var socket = io.connect('https://www...', {secure: true});

Websockets can't connect to server

I am trying to obtain some education on websockets but I can't really find a decent tutorial. All tutorials out there instruct you to download a server and teach you how to use it. I'm more interested in how the server actually works and how I can control it on a remote host, like a hosting provider.
Anyway if I wanna learn there really aren't many options other than to download a built server and start inspecting. So I downloaded the server given in this tutorial http://dev.tutsplus.com/tutorials/start-using-html5-websockets-today--net-13270
The problem for now is that I can't even seem to connect to it. I'm running XAMPP on Win7, so it's completely relevant to the tutorial and appears quite easy, however I fail. I've managed to start the server, but when I open client.php I get
Firefox can't establish a connection to the server at
ws://localhost:8000/pol/newWS/server/startDaemon.php. var socket =
new WebSocket(host);
Fortunately chrome appears to provide a more detailed error message
WebSocket connection to 'ws://localhost:8000/pol/newWS/server/startDaemon.php' failed: Error during WebSocket handshake: 'Sec-WebSocket-Accept' header is missing
Javascript's host variable is set to 'ws://localhost:8000/pol/newWS/server/startDaemon.php', that's where the server is located on my localhost. I haven't made any changes to the server. Can anyone help me get this thing going? Thanks in advance!
Websockets in PHP are generally a pain in the ass. Even if you use a library like rachet you need to start it separately, not through a webserver.
As brad said, consider using node.js or the excellent autobahn.ws for python.
I just found some WS server I have downloaded in the past which works pretty well. I can't confirm for any security issues but if anyone knows or finds anything please don't spare us the sharing. I searched for some info in the comments but I couldn't find anything about the creator so I can't really give any credits.
files here

Can't get sockets working - what silly thing am I missing?

I am trying to get into the brave new world of web sockets, but I can't get anything working.
I have downloaded and tried several PHP socket servers, but no joy. They seem very scarce on step-by-step info on what to do to actually get the thing working on your own server.
I am passing the path to the server script as the first argument to new WebSocket() - e.g. 'ws://localhost:33/sockets/server.php'. Is that right?
Should I be passing anything as the second param? I've read up, but I'm not quite sure.
Any help appreciated.
Path that you are passing to WebSockets have nothing to do with actual Path within filesystem.
When WebSocket is connecting to server, it just uses actual address "localhost" in your case, and port "33". Then in HTTP request on handshaking it will take the "path" details which is "/sockets/server.php" in your case, and will put them in handshake, so first line of handshake will look like that:
GET /sockets/server.php HTTP/1.1
So it will be used by you application to decide what to do with it. If you want to use it and make it look like related to actual files or use it your own way.
Here is some info from RFC 6455 on WebSockets URIs.
As well do not use port 33, as it is might be taken by dsp service. Check ports map here.
If you Bind your server side WebSocket to port 33, then it should proceed with connection.
After connection of TCP layer is established, it should proceed through HTTP Requests that is Handshaking.
After that is done, and was success. JavaScript on client side will throw onopen callback. If something went wrong it will throw onerror and onclose events.
After connection is successfully established and WebSocket did proceed through handshaking messaging can be made. Client will receive raw string as message, or binary (if server sends binary data, message with specific opcode). But server will receive data with framing and some header. Browsers do apply deframing automatically so on Client side you dont need to worry about that. But on Server side you have to do it or yourself, or use some existing libraries to handle that for you.
Here is official document of WebSockets protocol: RFC 6455. It has all information you need to know all aspects of WebSockets protocol.
In meantime, you might be interested for looking into ready solutions. And go through their examples.

FreeTDS - Linux server problems - both server and SQL admins say it's properly configured

First time user of FreeTDS. It is a "shared hosting" but we are the re-sellers and put in a ticket for them to install and configure it.
Situation:
We run a Linux setup ( we'll call them A ) and need to connect to a MSSQL database on a remote server managed by another company. We run a Red Hat variant I'm certain, and they have a Windows Server setup - We'll call them B.
So our Admins (A) assure us that they have properly installed and configured FreeTDS. Our Windows guys (B) have assured us they have opened up a port, allowed our IP address and setup remote access and given proper authorization to our account.
Yet, I still get an cannot connect to the database error using mssql_connect. I've gone back and forth with both sides on this and they both, while not blaming me, assure me of proper configuration on their end. I know I'm using the right user name and password, the right port number and proper IP address to the remote server. On top of this, I can telnet in and use fsockopen() to connect to the remote server. So the port is open and the IP unblocked, but I still get the error.
Am I doing something wrong? I'm terribly new to this (windows specifically), but when both 2nd and 3rd parties (As it were) say they are both doing things right, and my side of the deal is as simple as using mssql_connect() with the proper credentials, it makes it difficult. Top it off, the client is pissed that this isn't done yet, and the only explanation I have (due to the other parties having emailed the client saying their end is ok) is to plead that I'm new to this.
The actual error is:
Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: xxx.xxx.xx.xxx:1433 in /path/to/file/file.php on line 18
Error connecting to the database
I can't glean any other information - at least by any method I'm aware of.
I should not have taken this job, but is there any advice to be had - things to ask, ways to troubleshoot? I'm at a dead end and any I'll be forever grateful for any help.

Categories