Why is this Twitter API script not working?

I get an error from this Twitter script, which is why the rest of the page does not load. Not sure why this happens all of a sudden, where it functions properly for some time.

The script looks like this and it gains the current status of the user:

<?php  
$response = new SimpleXMLElement('http://twitter.com/users/show/tuscaroratackle.xml',NULL,TRUE);  
echo $response->status->text.'';  
?>

Here is another post in which I tried to figure out the answer to another error that pointed me to this error on Twitter.

You can see here in the footer or screengrab output: http://cl.ly/33IZ .

+1
source share
1 answer

( , ):

Warning: SimpleXMLElement::__construct(http://twitter.com/users/show/tuscaroratackle.xml) [simplexmlelement.--construct]: failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request in /home5/tuscaror/public_html/footer.php on line 47

Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: I/O warning : failed to load external entity "http://twitter.com/users/show/tuscaroratackle.xml" in /home5/tuscaror/public_html/footer.php on line 47

Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /home5/tuscaror/public_html/footer.php:47 Stack trace: #0 /home5/tuscaror/public_html/footer.php(47): SimpleXMLElement->__construct('http://twitter....', 0, true) #1 /home5/tuscaror/public_html/index.php(119): include('/home5/tuscaror...') #2 {main} thrown in /home5/tuscaror/public_html/footer.php on line 47

, : "HTTP- ! HTTP/1.1 400 Bad Request".

, - , HTTP- "http://twitter.com/users/show/tuscaroratackle.xml". 400 Bad Request.

-, , " " ( ), - . , - , - - HTTP, ( - ) .


twitter :

400 Bad Request: The request was invalid.  An accompanying error message 
will explain why. This is the status code will be returned during rate limiting.

Twitter . , . , , , , .

, , , :

$str = file_get_contents('http://twitter.com/users/show/tuscaroratackle.xml');
echo $str;

- 400. , php curl, .

!

+2

Source: https://habr.com/ru/post/1753667/


All Articles