Jump to content

PHP fsockopen - proxy? (port blocked)


idire

Recommended Posts

I'm trying to use fsockopen to connect to an irc server.

 

The script works fine when i load it via localhost, but when I attempt to run it on my host (godaddy) it times out.

 

Presumably this is due to port being blocked. I have sent in a support ticket to the host about it.

 

The irc server allows connections on ports: 6667, 6668, 6669, 7000, 8080

 

So I read up on it, and found something about using a proxy to connect via port 80 to the server. (something called socks?) but I have no idea how to implement this...

 

my current code:

 

<?php
// Prevent PHP from stopping the script after 30 sec
set_time_limit(0);

// Opening the socket to the IRC network
$socket = fsockopen("darklite.be.eu.swiftirc.net", 6667) or die();
?> 

 

The error:

Warning: fsockopen() [function.fsockopen]: unable to connect to darklite.be.eu.swiftirc.net:6667 (Connection timed out)

Link to comment
Share on other sites

First try an IP instead of the domain, if you need the potentially dynamic aspect of using the name then use gethostbyname() to get the IP.

 

If i remember properly Godaddy wont allow you to use fsockopen, but try the above suggestion first.

 

And with Godaddy it's usually better to call then submit a ticket.

Link to comment
Share on other sites

First try an IP instead of the domain, if you need the potentially dynamic aspect of using the name then use gethostbyname() to get the IP.

 

If i remember properly Godaddy wont allow you to use fsockopen, but try the above suggestion first.

 

And with Godaddy it's usually better to call then submit a ticket.

 

http://help.godaddy.com/article/287

 

I'll try with the ip now. EDIT: still times out

 

But i'm now not sure if godaddy allows irc bots to be run, due to processor usage or something

Link to comment
Share on other sites

You'll learn a lot more if you can get into your server. I'm paying $85 a month for a dedicated, just spent $600 for a server and $120 for hard drives - so I can then spend $200/mo to colocate it locally. Going to have 250/gig in RAID with dual, dual-core opterons @ 2.2, 4 gig DDR2, 10 meg burst, redundant power and Solaris 10 -- That's way better than godaddy.

Link to comment
Share on other sites

You'll learn a lot more if you can get into your server. I'm paying $85 a month for a dedicated, just spent $600 for a server and $120 for hard drives - so I can then spend $200/mo to colocate it locally. Going to have 250/gig in RAID with dual, dual-core opterons @ 2.2, 4 gig DDR2, 10 meg burst, redundant power and Solaris 10 -- That's way better than godaddy.

 

Also way more expensive. Congrats on the machine, but not everyone can justify/budget a dedicated server.

 

Cant afford 30 a month for hosting atm, as its only a learning project.

 

Nevermind i'll just do something else, cant host the bot on my home pc as the mysql server can only be accessed internally

 

Most shared hosting providers will block IRC bots, even if they allow fsock. Attempting to get around this is a good way to get a whack on the head by a ban stick, or sometimes worse.

Link to comment
Share on other sites

They are cheap :P and their server is fast for me

 

far better than my free one I used, cant speak for any other paid server as this was the first one i've used

 

I think having no server is better than having a free server.  And nearly every paid service is better than GoDaddy, it's just that GoDaddy can afford a Superbowl commercial.  Check out http://www.bluehost.com and http://www.hostgator.com because I think that they're much better.  Although optimally, you'd want a dedicated server, but that costs a decent amount of money, unless you create a lot of revenue from your site.  Then it's worth it. xD

Link to comment
Share on other sites

Good luck finding a shared hosting provider that will allow IRC bots, or bots of any kind for that matter.

 

I love dreamhost... many bitch about them, but for shared hosting their flexibility and allowances are unmatched. As a test/dev server or something personal that doesn't need insane uptime ( I'd say they have times when they're 93-95% uptime, but usually around 99% ) they're perfect. I'm running my own build of PHP, MySQL can be accessed remotely, and you get complete/unlimited shell access/users.

 

http://www.anhosting.com/ for anything else.

Link to comment
Share on other sites

They are cheap :P and their server is fast for me

 

far better than my free one I used, cant speak for any other paid server as this was the first one i've used

 

I think having no server is better than having a free server.  And nearly every paid service is better than GoDaddy, it's just that GoDaddy can afford a Superbowl commercial.  Check out http://www.bluehost.com and http://www.hostgator.com because I think that they're much better.  Although optimally, you'd want a dedicated server, but that costs a decent amount of money, unless you create a lot of revenue from your site.  Then it's worth it. xD

 

Whats wrong with godaddy? I'm not saying your wrong, i just dont know either way

 

and i dont live in the us so wasnt affected by advertising, (found godaddy by web searching for a day and comparing) my main needs from the server are: speed, mysql speed and cron all of which godaddy does well.

 

my site is for me to learn, but is also live with proper visitors, adsense records about 1500-2000 page impressions a day,

 

and the internal stats page records about 55000+ page requests in last 7 days, and 1gp transfer.

 

bought the server about a month ago

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.