Frage

So, I'm new to working with API's and PHP, so bear with me. I'm trying to hit an API to authenticate into the site via GET parameters (as suggested in the API documentation). I'm trying to use file_get_contents() to return the authentication token it returns. A redirect to the URL outputs the token in XML format.

However, when I do the following, it returns an empty string. How can I return the full XML output?

$token = file_get_contents('http://example.com/api.asp?cmd=logon&email=xxx@something.com&password=s0mep@SSword');
var_dump($token);

I get the following output:

string(116) ""

Any ideas about what I'm doing wrong?

Keine korrekte Lösung

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top