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 8676735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:16:22+00:00 2026-06-12T20:16:22+00:00

I am totally new to php. I had 2 pages let A.php and B.php

  • 0

I am totally new to php. I had 2 pages let A.php and B.php want to run Page B while I am at Page A.For that I had created a Socket Connection and able to run The Page B but problem is that when I send an array of objects to page B.page A send only the First object listed in the array and other values of the array were nothing
here is my some code
in A.php

$arr = array("message" => $pushData,
  "messageType" => $messageType,
  "displayGroupID" => $displayGroupID,
  "db"=>$db);
$fp1 = $this->JobStartAsync('localhost', 'B.php', $arr);
$r1 = $this->JobPollAsync($fp1);

function JobStartAsync($server, $url, $data, $port=80,$conn_timeout=10, $rw_timeout=86400)
{
    $errno = '';
    $errstr = '';
    $data = http_build_query($data);

    set_time_limit(0);

    $fp = fsockopen($server, $port, $errno, $errstr, $conn_timeout);

    if (!$fp)
    {
        echo "$errstr ($errno)<br />\n";
        return false;
    }

    $out = "POST $url HTTP/1.1\r\n";
    $out .= "Host: $server\r\n";
    $out .= "Content-type: application/x-www-form-urlencoded\r\n";
    $out .= "Content-length: ". strlen($data) ."\r\n";
    $out .= "Connection: Close\r\n\r\n";
    $out .= "$data";
    stream_set_blocking($fp, false);
    stream_set_timeout($fp, $rw_timeout);
    fwrite($fp, $out);
    //fwrite($fp, $data);
    return $fp;
}

function JobPollAsync(&$fp)
{
    if ($fp === false)
        return false;

    if (feof($fp))
    {
        fclose($fp);
        $fp = false;
        return false;
    }

    return fread($fp, 10000);
}

IN B.php

fileWrite ($_POST['displayGroupID'],$_POST['message'],$_POST['messageType']);

it get only “message” as it is listed as 1st element in array

  • 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-12T20:16:23+00:00Added an answer on June 12, 2026 at 8:16 pm

    Take a look at CURL. This is what you need and everyone else uses.

    ch = curl_init();
    
    curl_setopt($ch, CURLOPT_URL,"http://www.example.com");
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS,
            "postvar1=value1&postvar2=value2&postvar3=value3");
    
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    
    $response = curl_exec ($ch);
    
    curl_close ($ch);
    

    For async variation take a look at a similar question answered before – How do I make an asynchronous GET request in PHP?

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

Sidebar

Related Questions

Totally new to Capistrano. I have a local git repository that I want to
I'm totally new to django, coming from a PHP perspective. I want to write
having same issue, i am totally new in php. i install XAMPP then download
I'm totally new to AWS. I managed to have an instance that runs PHPMyAdmin.
I'm totally new in OpenCV so hopefully that's not a too stupid question. As
This is a totally new area for me so please be patient. I want
I am new to PHP and today I was able to display my first
I am totally new to Flex mobile developing. In FlashBuilder for PHP, you need
I know PHP a little. But Python is totally new for me. I only
I'm totally new to PHP and MySQL but I'm implementing the Facebook PHP SDK

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.