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

  • Home
  • SEARCH
  • 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 9214981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:05:56+00:00 2026-06-18T02:05:56+00:00

Good day! I use file_get_contents for give answer from remote address and explode for

  • 0

Good day!

I use file_get_contents for give answer from remote address and explode for create array give data.

For this i use next code:

function test(){
$project_key='fg54gth5k7';
$postdata = http_build_query(
    array(
        'code' => $project_key
    )
);
$opts = array('http' =>
    array(
        'method'  => 'POST',
        'header'  => 'Content-type: application/x-www-form-urlencoded',
        'content' => $postdata
    )
);
$context  = stream_context_create($opts);
$result = file_get_contents('http://test.com/', false, $context);
return $result;
}

$res = test();
echo $res;

$part=explode(' ',$res);
var_dump($part);

echo $res return row:

3434343 http://test.com/index.php?r=site/stepone
&temptoken=c68c0ae1cece433fe5d6f6578cc0a9b6 OK68 OK Redirect 
http://test.com/index.php?r=site/stepone&temptoken=c68c0ae1cece433fe5d6f6578cc0a9b6 0

var_dump() return array

array(5) { 
[0]=> string(8) "3434343" 
[1]=> string(0) "" 
[2]=> string(0) "" 
[3]=> string(110) "http://test.com/index.php?r=site/stepone
    &temptoken=c68c0ae1cece433fe5d6f6578cc0a9b6 OK68 OK Redirect"

[4]=> string(100) "http://test.com/index.php?
    r=site/stepone&temptoken=c68c0ae1cece433fe5d6f6578cc0a9b6 0 " 

}

Tell me please why am I getting the wrong array?

array should been next:

array(10) { 
    [0]=> string(8) "3434343" 
    [1]=> string(0) "" 
    [2]=> string(0) "" 
    [3]=> string(110) "http://test.com/index.php?r=site/stepone
        &temptoken=c68c0ae1cece433fe5d6f6578cc0a9b6"
    [4]=> string(4) "OK68 OK Redirect"
    [5]=> string(2) "OK Redirect"
    [6]=> string(8) "Redirect"
    [7]=> string(100) "http://test.com/index.php?
        r=site/stepone&temptoken=c68c0ae1cece433fe5d6f6578cc0a9b6"
    [8]=> string(1) "0"
    [9]=> string(0) ""

Tell me please where error?

  • 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-18T02:05:57+00:00Added an answer on June 18, 2026 at 2:05 am

    They might not be the space character, but tabs etc.

    Use preg_split with the delimiter [\s]+.

    \s stands for “whitespace character”. It includes [ \t\r\n] generally.

    (Reference)

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

Sidebar

Related Questions

Good day, I have a library project that i use to create a paid
Good day. I could really use your help on this one. I have a
I've been toying with this all day. From my understanding, you can use reference
I've read that It's a good experience to use a fresh image every day
Good Day, Can someone confirm what was said at the bottom of this post
Good day, I try to start new Activity from another. But it always crashed.
Good day to you, I use Castor to map network infrastructure into Java classes.
Good Day everyone!! One question.. or two.. Is it possible to use Expression Blend
Good day! I've the following ViewModel class I use for login form: using System.ComponentModel.DataAnnotations;
Good Day I have a project that makes use of custom assemblies in the

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.