Reputation: 1008
I have a PHP file.
Based on the PHP the server generates a output string for example say
111 success: id:12345678 |value:10000045
Is it possible to store this output in variable and use it? say
$input = 12345678
I also do not want to store the entire output generated by the server in $input variable ,i just want to save some part of the output in it.
For example i only want to save only id not value.
How can i do these?
Upvotes: 2
Views: 132
Reputation: 11044
$server_said = file_get_contents('http://serveroutput.com/theoutput.php');
if (preg_match('/id\:(\d*)/', $server_said, $matches)) {
$input = $matches[1];
}
Upvotes: 2