parsing external cgi script results to variable in PHP

Posted on 2009-02-17
Last Modified: 2013-12-25
I want to put the reult of a CGI script into a string, then into an array so i can reformat the results.
I am able to call the external CGI script, which returns the correct result but cant figure out how to get the reults into a string.

The external CGI script is:

The value that is returned is:

does anybody know how to do this?

$pstn2 = $_POST["pstn"]; 

echo "$pstn2"; 

echo "<br /><br />";

$str = include(""); 

echo "<br /><br />";

echo $str;

echo "<br /><br />";

echo $str;

echo "<br /><br />";


Open in new window

Question by:bilbo-uk
    LVL 9

    Accepted Solution

    try this:
    $url = urlencode("");
    $str = file_get_contents($url); 

    Open in new window

    LVL 51

    Expert Comment

    eval('$arr=array("'. str_replace(" ",'","',str_replace("=",'"=>"',file_get_contents(""))).'");');

    Author Comment

    Sorry but the person who posted this has now left the company hence why a comment has not been left earlier.  I don't think it was a complete solution but gave him some things to try which lead to working out how to do it.  

    If I can find where the code is I will post what he ended up going with



    Author Closing Comment

    In the end this was done as follows by the look of things

    $str = file_get_contents("$pstn2&user=&pass=");
    $a = explode(" ", $str);

    Then access those array variables

    $length = "$a[3]";
    $down = "$a[1]";
    $status = "$a[2]";
    $up = "$a[0]";



    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    HTML table 7 38
    How to determine the cell phone carrier 3 36
    Total days in a month 12 27
    simple if statement 3 12
    Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
    Part of the Global Positioning System A geocode ( is the major subset of a GPS coordinate (, the other parts being the altitude and t…
    This video teaches users how to migrate an existing Wordpress website to a new domain.
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now