Murciano Posted January 13, 2011 Share Posted January 13, 2011 HI, Im having an issue with a small piece of custom php code inside WP, heres a brief explanation of what im doing and below is the code. Im using a permalink structure of %category%/%postname% Basically im using simplehtml dom to grab some stocks info and write it to a text file, which it does when i use this code: include ('crawler_file.php'); $html = file_get_html("http://url that the info comes from/ticker=$Symbol:US"); $es = $html->find('div[class="detailsDataContainerLt"]'); $tickerdetails = ("$es[0]"); $CompDetails = "$Symbol.txt"; $FileHandle2 = fopen($CompDetails, 'w') or die("can't open file"); fwrite($FileHandle2, $tickerdetails); fclose($FileHandle2); however when i use that code above it gets the info ok but writes the file into WP root and not into the same folder from where called within the theme, strange thing is though the include file gets included no problem. I have tried absolute URL and also bloginfo each just throws out "or die" error of Cant Find File. Its obviously a paths issue but im stuck as what to do next thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.