Help / Forums / API

Current Discussion

more...
  

Http error 404 for XML requests

Tarantul wrote:
quote selection
For old system all works fine.

Example:
http://www.discogs.com/release/1249894?f=xml&api_key=API_KEY

but for new with Artis-Title in url:

http://www.discogs.com/Schiller-Sehnsucht-Deluxe-Edition/release/1249894?f=xml&api_key=API_KEY

I have 404 error.

Is this bug or works as intended?
posted over 3 years ago. ( permalink | report )
mmjazzja wrote:
quote selection
I have the same problem
if the parameter f=xml is used
a 404 is returned
posted over 3 years ago. ( permalink | report )
quote selection
I also stumbled over this hiccup.
My solution: parse the release ID from the URI and create an old-style URI myself.

It's a shame that the URI returned for an Xml request doesn't support an Xml request itself...
posted over 3 years ago. ( permalink | report )
Mr.Isaacs wrote:
quote selection
what kind of command do i use in php to read out this xml??

thanks in advance
posted over 3 years ago. ( permalink | report )
Mr.Isaacs wrote:
quote selection
what kind of command do i use in php to read out this xml??

thanks in advance
posted over 3 years ago. ( permalink | report )
eazyraida wrote:
quote selection

Mr.Isaacs
what kind of command do i use in php to read out this xml??


Do you mean how to parse XML with PHP in general?

You could easily parse it via simplexml_load_file([URI]);. But make sure to implement some fallbacks because this function propably throws warnings if the file isn't valid.

see http://www.php.net/simplexml_load_file
posted over 3 years ago. ( permalink | report )
Mr.Isaacs wrote:
quote selection
@eazyraida:
i tried a few times
and this time you write me this code. i tried it
a last time and id wouldn't work.
i looked to some sites of google results.
yet i've tried it as you wrote me 1:1.

my input:

$xml = simplexml_load_file('http://www.discogs.com/release/183964?f=xml&api_key=' );

print_r($xml);


here's my error output

Warning: simplexml_load_file(http://www.discogs.com/release/183964?f=xml&api_key=) [function.simplexml-load-file]: failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request in /var/www/virtual/mydomain.net/htdocs/test.php on line 2

Warning: simplexml_load_file() [function.simplexml-load-file]: I/O warning : failed to load external entity "http://www.discogs.com/release/183964?f=xml&api_key= in /var/www/virtual/mydomain.net/htdocs/test.php on line 2


on my server runs 5.2.0-8+etch11
posted over 3 years ago. ( permalink | report )
Mr.Isaacs wrote:
quote selection

Mr.Isaacs
@eazyraida:
i tried a few times
and this time you write...
...
...
...virtual/mydomain.net/htdocs/test.php on line 2

on my server runs 5.2.0-8+etch11


surely i put my api key in.
posted over 3 years ago. ( permalink | report )
eazyraida wrote:
quote selection
Hum...

what kind of error/result do you get if you try this code:

$result = file_get_contents('http://www.discogs.com/release/183964?f=xml&api_key=[API_KEY]' );

print_r($result);
posted over 3 years ago. ( permalink | report )
Glove93 wrote:
quote selection
Hello,

Tarantul

for new with Artis-Title in url:

http://www.discogs.com/Schiller-Sehnsucht-Deluxe-Edition/release/1249894?f=xml&api_key=API_KEY

I have 404 error.

Is this bug or works as intended?


Just ran into the same problem. No word on it being a bug and whether it will be fixed yet?

Thanks and best regards
posted over 3 years ago. ( permalink | report )
Glove93 edited this message over 3 years ago.
Mr.Isaacs wrote:
quote selection
Input
$result = file_get_contents('http://www.discogs.com/release...l&api_key=[API_KEY]' );

print_r($result);


Error-Message:
Warning: file_get_contents(http://www.discogs.com/183964?f=xml&api_key=[API_KEY]) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found in /var/www/virtual/mydomain.net/htdocs/test.php on line 2
posted over 3 years ago. ( permalink | report )

This topic is older than 90 days and cannot be replied to.