Jump to content

array error handling


Recommended Posts

Im having problems with error handling here

heres the snippet from the full code

$pids= _INetGetSource($site & "index.php?showtopic=" & $output[$i] & "/")
if @error = 1  then _temps()
$desc = _StringBetween($pids,'<meta name="description" content="',': " />')
if @error = 1  then _temps()


$new_desc1=  StringReplace($desc[0],"&58;",":")

now the problem is the last line , it errors now and again .. giving a message like

"non-array value , $desc[0]"

it shouldnt have even got that far with the error handling

the code above loops 10 time btw and it doesnt do it all the time just now and again

Thanks

Link to comment
Share on other sites

You need to use the conditional instructions to check for condition. You don't have anything like try..catch in AutoIt because it's not necessary if you check for the correct condition before taking any action in code. Only COM error trapping is possible but your code has nothing to do with COM objects. >_

Link to comment
Share on other sites

i have the same problem and worked out it is because of the way the tag is sometimes written:

- <meta name="description" content="blah blah">

- <meta content="blah blah" name="description">

i have a script that uses an imbedded ie control and it used to work fine as it picked up tags in the first format ... i updated to ie8 and now the tags are displayed as per the second format ... not sure if the update is related but now i have the same problem

so i need to find a way to deal with tags being displayed in either format

ggrr!!!!!

serge

Edited by smbotans

Get a comprehensive SEO evaluation of web site.Discover the right keywords for your web site.Looking for affordable ebooks.Mental exercises to keep your mind active.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...