Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8844477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:29:50+00:00 2026-06-14T11:29:50+00:00

I would like to declare multiple variables using the output of my script and

  • 0

I would like to declare multiple variables using the output of my script and the stream_get_line php function.

Example:

<?php

$fp = fsockopen("10.73.xxx.xxx", "23");

fputs($fp,"user\r");
sleep(1);
fputs($fp,"password\r");
sleep(1);

$content = stream_get_line($fp, 100, "user");
$content2 = stream_get_line($fp, 100, "password");


echo $content;
echo $content2;
?>

However, the script stops working after I use the stream_get_line once. How can I use it multiple times to grab multiple lines of output? It works fine if I remove the second stream_get_line function.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T11:29:51+00:00Added an answer on June 14, 2026 at 11:29 am

    I ended up using the following code:

    $fp = fsockopen("10.73.xxx.xxx", "23");
    
    fputs($fp,"user\r");
    sleep(1);
    fputs($fp,"password\r");
    sleep(1);
    
    while(!feof($fp)) {
        $content = stream_get_line($fp, 100, "user");
        $content1 = substr($content, 10, 4);
        $content2 = substr($content, 15, 8);
    }
    

    I store the whole thing in the variable “content” and then build 2 extra variables “content1” and “content2”, where I pull the desired output from the variable “content”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In JavaScript, it is possible to declare multiple variables like this: var variable1 =
I would like to declare some integer constants in PowerShell. Is there any good
i would like to do this: DECLARE @TmpTable TABLE = select * from someTable
I would like to know how do I declare a record, that has some
I would declare an empty String variable like this: string myString = string.Empty; Is
I have written my own function, which in C would be declared like this,
Would like someone to take a look at my script and tell me where
I would like some opinion, example and code on how everyone dose this.. So
I would like to query multiple tables from SQL Server 2005 and create a
I use the Scanner class for reading multiple similar files. I would like to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.