473,473 Members | 2,167 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to connect to REST server with fsockopen

2 New Member
I have been trying unsuccessfully to connect to a REST server to get MLS data, pretty much all php scripts/classes use fsockopen to connect and I realized for some reason I can't even get the simple fsockopen function to connect.

Expand|Select|Wrap|Line Numbers
  1. $url = "rets17lax.raprets.com";  
  2. $port=6103; 
  3.  
  4. $fp = fsockopen($url,$port,$errno,$errstr,30);
  5. if (!$fp) {
  6.       echo "$errstr ($errno)<br />n";
  7. } else {   
  8.  
  9.         echo ' 
  10.             Socket connection created to <strong>' . $url . '</strong> on port <strong>' . $port . '</strong> 
  11.         '; 
  12.  
  13. }
Ive been told that the rest server is valid, is there something im doing wrong with the fsockopen function? I just cant seem to get it to connect. This is the error:
Warning: fsockopen() [function.fsockopen]: unable to connect to rets17lax.raprets.com:6103 (Connection refused)

Thanks!
May 10 '10 #1
3 3305
dlite922
1,584 Recognized Expert Top Contributor
Check your firewall, I'm able to connect.

You must be having a network issue.

What do you get when you type in "telnet rets17lax.raprets.com 6103" on a command prompt on that PC?



Dan
May 10 '10 #2
scoob19
2 New Member
Thanks for the reply Dan. If it's a network issue, would the fsockopen script i copied and pasted still have problems if i upload it to the server? Here is where i uploaded those few lines of code to connect to the RETS server with fsockopen:

http://www.siderow.com/retslogin.php


I'm running Vista btw, and to answer your question when i type that into the command prompt on my PC, here is what i get:

Expand|Select|Wrap|Line Numbers
  1. HTTP/1.0 400 Bad request
  2. Content-Type: text/html
  3.  
  4. <h2>Client sent a bad request.</h2>
  5.  
  6. Connection to host lost.
Thanks
May 11 '10 #3
dlite922
1,584 Recognized Expert Top Contributor
I was able to run your code as is.

Expand|Select|Wrap|Line Numbers
  1. C:\_www\test>php -q -f test.php
  2.  
  3.             Socket connection created to rets17lax.raprets.com on port 6103
  4. C:\_www\test>
  5.  
  6.  
Looks like it runs on your server too at the URL you provided.

I only have the default PHP/MySQL package installed.


Dan
May 11 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Loopy | last post by:
I'm trying to write a script that will connect to an external site so that I can get access referer information in a database on another one of my sites. I got errors, so I tried to write a script...
9
by: fipaj1992 | last post by:
Hi! I have very big problem with fsockopen() function. It is very important... That's code: <?php $test = fsockopen ('chrome.pl', '8080'); ?>
1
by: Syl | last post by:
Hi group - I have a database table with 4 columns that hold a url. I am selecting each url and I need to check to see if it is valid. I assumed I could use the fsockopen command. I've had to...
5
by: webbyfoot | last post by:
I've a form where users suggest a website by entering the url - and want to redirect them to a 'thanks but no thanks' page if the site doesn't actually exist I tried the following: $fp =...
8
by: Yoko | last post by:
So I am using php version 4.3.9 and lets say i have a file on the server called tester.php so i am using fsockopen to point to that file but it gives me a error below. $fh =...
2
by: Alex | last post by:
Hi all, I'm having a problem with fsockopen function, I'm programming with php 4.3 and need to do an HTTP POST over secure socket, ssl, here's my code: $context = stream_context_create();...
4
by: keychain | last post by:
I'm experience the infamous "SSL: Fatal Protocol Error" bug with Apache 2.x According the fopen() documentation: "If you are using fsockopen() to create an ssl:// socket, you are responsible...
6
by: henryrhenryr | last post by:
Hi I'm really hoping for some ideas! I have been setting up phpmailer on my server and it was working nicely on my local server so I uploaded to my live server and tested. The mystery is that...
5
by: aswathip | last post by:
I am new to sockets and fsockopen(). I am trying to send SMS using a gateway. But the fsockopen always shows the following error. Warning: fsockopen() : unable to connect to alertbox.in:80 (A...
1
by: jeddiki | last post by:
Hi, I am modifying a ipn script for my use and want to fully understand what it is doing. It seems to me that it is trying to do a cUrl and if that fails it uses a fsockopen function. Here are...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.