Category Archives: errors

PHP __autoload() Errors

Some of you may have experienced problems when using

__autoload()

in multiple scripts. So, the better way is to avoid

__autoload()

and use

spl_register_autoload()

instead. If you have written this already, just rename your function to something like

__autoload_my_classes

, and in the next, call

spl_autoload_register

as:

    <?php
function __autoload_my_classes($classname)
{
  # ... your logic to include classes here
}
spl_autoload_register('__autoload_my_classes');
?>

By calling it repeatedly with different function names, you can assign multiple functions to

spl_autoload_register()

. Be sure to limit your every function to include a CLASS file.

All PHP Scripts on this website are provided by phpscripts4u.com where you can find all the latest PHP code snippets, plugins and libraries.

Notice: Undefined index: oAuth_token in Localhost

Have you encountered a PHP error like this? Notice: Undefined index: oauth_token in localhost. If so, then read on to know how to fix it.

Debugging Errors

If you get this error: Notice: Undefined index: oauth_token in localhost\php\twitteroauth.php on line 82
Try this in the code and see what it output:
$token = $twitteroauth->get('account/verify_credentials');
var_dump($token);

The only way to do

localhost

development is to create another application with a specific

callback url

to

http://localhost/php/twitteroauth.php
Unable to post tweet:

All PHP Scripts on this website are provided by phpscripts4u.com where you can find all the latest PHP code snippets, plugins and libraries.

Error: Read-only Application cannot POST

Error: Read-only application cannot POST. You may have ran into this type of error and been wondered what was wrong. You might just be missing something out.. see below.
If you cannot post a tweet it might be because your application is set to read only. You can change it in your twitter app settings.

All PHP Scripts on this website are provided by phpscripts4u.com where you can find all the latest PHP code snippets, plugins and libraries.

Error: No Access Token being Passed in Auth Request

Error: No access token being passed in Auth request.
Why could the access token be missing from the Twitter Auth request?
no-access-token-being-passed
Twitter oAuth giving you this error: “There is no request token for this page.”

No token is being passed with the request. Simple when you see it eh!?

If we turn on debug we can see the request token is being generated.
request-tokens

All PHP Scripts on this website are provided by phpscripts4u.com where you can find all the latest PHP code snippets, plugins and libraries.

php ‘Serialization of ‘SimpleXMLElement’ is not allowed’

php ‘Serialization of ‘SimpleXMLElement’ is not allowed’

when bringing in linkedin data i got this error.

‘Serialization of ‘SimpleXMLElement’ is not allowed’

I found this fixed it, not ideal, quick a dirty but it works.

//workaround for error: php 'Serialization of 'SimpleXMLElement' is not allowed'
$d = json_decode(json_encode($d));