/    Sign up×
Community /Pin to ProfileBookmark

fsockopen() question

I am working on an fsockopen() function and it seems to working but nothing is being returned.

i wanted to make sure i wasn’t missing anything. before I go and look at configuration files and such.

[code=php]
$fp = fsockopen($this->_dsUrl,8080,$errno,$errstr,60);

if(!$fp){
echo “$errstr ($errno)<br />n”;
}else{
fwrite($fp,$output);
while(!feof($fp)) {
echo fgets($fp);
}
fclose($fp);

}
[/code]

this code is part of a bigger php class, but should be enough code to verify that I am asking for the correct information back from the server.

any ideas?

Thanks,
-V

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@MindzaiJul 23.2009 — Is nothing being returned, or is fsockopen returning false? Also do you have error_reporting set at a level which would show warnings? And what is the value of $this->_dsUrl ?
Copy linkTweet thisAlerts:
@vonshavingcreamauthorJul 23.2009 — I am just getting a blank screen.

the fsockopen is not erroring out.

$this->_dsUrl is the host name of the server I am trying to access.

in this case ... blue.intra.com

when I check the tomcat logs the request is being applied, just nothing is getting returned.

the request is valid.

also i have this

[code=php]
ini_set('display_errors','On');
[/code]
Copy linkTweet thisAlerts:
@MindzaiJul 23.2009 — do you get a warning level error from fsockopen if you add the following line to the top of the script:

[code=php]error_reporting(E_ALL);[/code]

You also might want to try specifying the port as part of the url:

[code=php]$fp = fsockopen($this->_dsUrl . ':8080',8080,$errno,$errstr,60);[/code]
×

Success!

Help @vonshavingcream spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...