Reputation: 99
i'm trying to receive a response from an url as :
$result = file_get_contents('http://example.com/api/test');
it simply returns some informations separated by |
example :
info1|info2|info3
i want to get that result as an array
something like $result = array(file_get_contents('http://example.com/api/test'));
I just got involved in php stuffs excuse me for any confusing terms !
Upvotes: 1
Views: 2178
Reputation: 6348
You can use explode()
to separate the data by pipe.
$result = explode('|',file_get_contents('http://example.com/api/test'))
Upvotes: 0