Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Connecting to a server and if it recives a certain thing, it echos something.
Old 08-31-2008, 07:05 PM Connecting to a server and if it recives a certain thing, it echos something.
Junior Talker

Posts: 3
Name: Mark
Trades: 0
What I want it to do is, it connects to a certain server and then does a few things (already have up to this part coded). But I want to know how to code it to where if it recives this from the server "(<font color='error'>Sorry, the specified dream is not available at this moment.</font>" it echos something. Any help would be nice.

Thanks!
Ricochet is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-31-2008, 11:45 PM Re: Connecting to a server and if it recives a certain thing, it echos something.
blackfalcon's Avatar
Skilled Talker

Latest Blog Post:
New Site: 10DollarBluRay.com
Posts: 62
Name: JuanJose H. Galvez
Trades: 0
I'm not sure what your current code looks like but let's give an example:

$pos = strrpos($responsefromserver, "Sorry, the specified dream is not available at this moment.");
if ($pos === false) {
//something was found
} else {
//not found!
}

Hope this helps!
__________________
Latest Project:
Please login or register to view this content. Registration is FREE
<--CHECK IT OUT!
My Company:
Please login or register to view this content. Registration is FREE

I'm
Please login or register to view this content. Registration is FREE
blackfalcon is offline
Reply With Quote
View Public Profile Visit blackfalcon's homepage!
 
Old 09-01-2008, 02:35 PM Re: Connecting to a server and if it recives a certain thing, it echos something.
Junior Talker

Posts: 3
Name: Mark
Trades: 0
That did not work. My whole code looks like this:

PHP Code:
<?php
$socket 
fsockopen("lightbringer.furcadia.com"21);
// Are we able to connect?
if(!$socket) {
    echo 
"Unable to connect to the Furcadia game server at this time";
} else {
fputs($socket,"connect Ice|Torch <gamepass>\n");
sleep(2);
fputs($socket,"wh Ricochet606 Bot online\n");
sleep(1);
fputs($socket,"fdl furc://furcadianfanclub/\n");
$data fgets($socket4096);
$pos strrpos($data"Sorry, the specified dream is not available at this moment.");
if (
$pos === false) {
//something was found
echo "The Dream is current uploaded.";
} else {
//not found!
echo "The dream is currently NOT uploaded.";
}
}
fputs($socket,"quit");
?>
Ricochet is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Connecting to a server and if it recives a certain thing, it echos something.
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.11155 seconds with 12 queries