I've set a crawler up in wordpress which grabs stocks data and creates to file for that when a person makes its way into symbolicOrticker the variable is read and when it matches the information of the previous crawl for your particular companies data will echo the written text file on-page, if no information is found the crawler then sparks grabs it and creates to file for in order to save for the following time that symbol can be used.

The issue im getting is the fact that everything works groovey aside from one factor, once the submissions are written to file for it saves it within the Wordpress root and never in the subfolder from the theme, basicaly which means that root becomes untidy very rapidly as well as if the theme be utilized on another site then it's improper as some important information is missing. I've attempted bloginfo and absolute both return exactly the same failure.

This is actually the code i'm using to create to file for, like i only say it really works aside from writing the file into root.

<?php
$CompDetails = "http://www.devserverurl.com/mattv1/wp-content/themes/stocks/tools/modules/Stock_Quote/company_details/$Symbol.txt"; 

if (file_exists($CompDetails)) {}
else
{
include ('crawler_file.php');
$html = file_get_html("http://targeturl.com/research/stocks/snapshot/snapshot.asp?ticker=$Symbol:US");
$es = $html->find('div[class="detailsDataContainerLt"]');
$tickerdetails = ("$es[0]");
$FileHandle2 = fopen($CompDetails, 'w') or die("can't open file");
fwrite($FileHandle2, $tickerdetails);
fclose($FileHandle2);
}
?>

edit below, also have attempted this and also the same happens as above

<?php

if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/wp-content/themes/stocks/tools/modules/Stock_Quote/company_details/$Symbol.txt")) {}  
else  
{  
include ('crawler_file.php');  
$html = file_get_html("http://targeturl.com/research/stocks/snapshot/snapshot.asp?ticker=$Symbol:US");  
$es = $html->find('div[class="detailsDataContainerLt"]');  
$tickerdetails = ("$es[0]");  
$FileHandle2 = fopen($_SERVER['DOCUMENT_ROOT'] . "/wp-content/themes/stocks/tools/modules/Stock_Quote/company_details/$Symbol.txt", 'w') or die("can't open file");  
fwrite($FileHandle2, $tickerdetails);  
fclose($FileHandle2);  
}  
?>  

Its most likely some type of file permissions problem. Also, you would be much best while using WordPress upload sites anyway since it must be writable to operate correctly anyway.

Use wp_upload_dir() to obtain the uploads path. The return value is going to be an assortment with data relating to dated folders (which you do not need) but you will get the bottom uploads dir title from there after which make use of the info to produce your personal 'ticker_data' folder to keep your computer data in.

Thank you for making the effort to answer my question Gipetto, heres where i stand now, i've produced a folder in uploads and referred to it as "company_particulars" write permissions are going to 777 on uploads folder and company particulars folder and i have tried personally this code Thank you for making the effort to answer my question Gipetto, heres where i stand now, i've produced a folder in uploads and referred to it as "company_particulars" write permissions are going to 777 on uploads folder and company particulars folder and i have tried personally this code.

<?php
$CompDetails = wp_upload_dir();   
if (file_exists($CompDetails['basedir'].'/company_details/'.$Symbol.txt))  
{}  
else  
{  
include ('crawler_file.php');  
$html = file_get_html("http://targeturl.com/research/stocks/snapshot  /snapshot.asp?ticker=$Symbol:US");  
$es = $html->find('div[class="detailsDataContainerLt"]');  
$tickerdetails = ("$es[0]");  
$FileHandle2 = fopen($CompDetails, 'w') or die("can't open file");  
fwrite($FileHandle2, $tickerdetails);  
fclose($FileHandle2);  
}  
?>  

it's no more writing the file into root, yet it's now tossing the "cant open file" error