scbookz Posted August 2, 2009 Share Posted August 2, 2009 here is my code ---------------------------- <?php $oscfile = file_get_contents("http://www1.com/osc/osc/osc/catalog/product_info.php?products_id"); $osc = (get_oscdoc_title($oscfile)); //function function get_oscdoc_title($oscfile){ $osctag = preg_match_all('/$products_description/', $oscfile, $oscmatches, PREG_PATTERN_ORDER); return($oscmatches[1][0]);} $test = "$oscmatches"; $file = file_get_contents("http://www2.com/IsbnSearch.aspx?isbn={$test}"); $x = (get_doc_title($file)); echo preg_replace('/^Book -/','(10 digit isbn above) -',$x); // retrieve page title function get_doc_title($file){ $h1tags = preg_match_all('/<title>(.*)<\/title>/', $file, $matches, PREG_PATTERN_ORDER); return($matches[1][0]);} ?> ------------------------ here is my error ---------------------------- www2.com - ISBN format error! ----------------------------------------------------- this error is because a numeric value is not being placed at the end of the url/number but it is placing either a string or a non entity ----------------------------------------------------- i need a number value for product _description but it is not grabbing this from the .php file that is a database descriptor and the file i am trying to grab has code like this on that particular line ------------------ line 110 $product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'"); line 123 <p><?php echo stripslashes($product_info['products_description']); ?></p> ------------------ so in summary i need product_description but as a number and not as a string but i am not sure product description is a variable from this mysql database and possible java script Link to comment https://forums.phpfreaks.com/topic/168465-solved-i-am-1-step-away-from-being-done-on-a-3-year-project-please-help-php-code/ Share on other sites More sharing options...
scbookz Posted August 2, 2009 Author Share Posted August 2, 2009 what i have is an osc php mysql setup where i am grabbing from an html page and inserting into the products_description in order for me to work this right i have to use the database upload file they give for my bulk uploads so i have to use this setup because my bulk upload csv wont take much php it does take <iframe> in my cell csv upload my excel upload will take <iframe> and i include my .php file and then it post the products_description perfectly but the variable i need is the products_descriptionvariable this works good for 1 page but that variable i need is the kicker it comes from a html page but has some funky code i dont know i wonder if the description is even readable by php as i have it or do i need to take java code and convert it to php? i do not know java at all so i wonder if the description is even a variable that php can read Link to comment https://forums.phpfreaks.com/topic/168465-solved-i-am-1-step-away-from-being-done-on-a-3-year-project-please-help-php-code/#findComment-888642 Share on other sites More sharing options...
scbookz Posted August 2, 2009 Author Share Posted August 2, 2009 if i put a number in the variable then it works fine but that is a static umber i need the number to change according to the product description ww1 is an internal built in .php from oscommerce and ww2 is an eternal from oscommerce everything works until i try to add the "product_description" if i add a number it is fine but as i say it will display the same out put for each item i need this variable to make it right Link to comment https://forums.phpfreaks.com/topic/168465-solved-i-am-1-step-away-from-being-done-on-a-3-year-project-please-help-php-code/#findComment-888645 Share on other sites More sharing options...
Mardoxx Posted August 2, 2009 Share Posted August 2, 2009 $file = file_get_contents("http://www2.com/IsbnSearch.aspx?isbn={$test}"); is the problem because $test == "Array"... $test = $oscmatches[1][0]; kthx... Link to comment https://forums.phpfreaks.com/topic/168465-solved-i-am-1-step-away-from-being-done-on-a-3-year-project-please-help-php-code/#findComment-888646 Share on other sites More sharing options...
scbookz Posted August 2, 2009 Author Share Posted August 2, 2009 so the question is how do i get products_description from this line of code so that it is a numerical value line 123 <p><?php echo stripslashes($product_info['products_description']); ?></p> Link to comment https://forums.phpfreaks.com/topic/168465-solved-i-am-1-step-away-from-being-done-on-a-3-year-project-please-help-php-code/#findComment-888647 Share on other sites More sharing options...
scbookz Posted August 2, 2009 Author Share Posted August 2, 2009 oh i see so how do i make $test a number instead of an array? Link to comment https://forums.phpfreaks.com/topic/168465-solved-i-am-1-step-away-from-being-done-on-a-3-year-project-please-help-php-code/#findComment-888650 Share on other sites More sharing options...
Mardoxx Posted August 2, 2009 Share Posted August 2, 2009 post the whole code or pm it or something Link to comment https://forums.phpfreaks.com/topic/168465-solved-i-am-1-step-away-from-being-done-on-a-3-year-project-please-help-php-code/#findComment-888651 Share on other sites More sharing options...
scbookz Posted August 2, 2009 Author Share Posted August 2, 2009 can i take part of the array and make variables from the array? Link to comment https://forums.phpfreaks.com/topic/168465-solved-i-am-1-step-away-from-being-done-on-a-3-year-project-please-help-php-code/#findComment-888652 Share on other sites More sharing options...
Mardoxx Posted August 2, 2009 Share Posted August 2, 2009 http://uk3.php.net/preg_match_all look under matches. wait what... I don't see how this can work because surely http://www2.com/IsbnSearch.aspx?isbn= HAS to have an input of an ISBN number and at the moment you're matching ANYTHING before products_description which will NOT be an isbn number... Link to comment https://forums.phpfreaks.com/topic/168465-solved-i-am-1-step-away-from-being-done-on-a-3-year-project-please-help-php-code/#findComment-888653 Share on other sites More sharing options...
scbookz Posted August 2, 2009 Author Share Posted August 2, 2009 trust me the product_description value i have in my database is a number i am doing things a little reverse i did not want to mess with osc code so i use easypopulate but my description value is an isbn and not a description and then i am reverse engineering i am too far into it to change now i need that value a number to be showing on php as a single number and i think youare right it is an array right now can i break my array apart? into numbers Link to comment https://forums.phpfreaks.com/topic/168465-solved-i-am-1-step-away-from-being-done-on-a-3-year-project-please-help-php-code/#findComment-888654 Share on other sites More sharing options...
Mardoxx Posted August 2, 2009 Share Posted August 2, 2009 well that should be easy enough give this a shot: <?php $oscfile = file_get_contents("http://www1.com/osc/osc/osc/catalog/product_info.php?products_id"); $osc = (get_oscdoc_title($oscfile)); //function function get_oscdoc_title($oscfile){ $osctag = preg_match_all('/$products_description/', $oscfile, $oscmatches, PREG_PATTERN_ORDER); return($oscmatches[1]);} foreach ($osctag as $match) { $file = file_get_contents("http://www2.com/IsbnSearch.aspx?isbn={$match}"); $x = (get_doc_title($file)); echo preg_replace('/^Book -/','(10 digit isbn above) -',$x); } // retrieve page title function get_doc_title($file){ $h1tags = preg_match_all('/<title>(.*)<\/title>/', $file, $matches, PREG_PATTERN_ORDER); return($matches[1][0]);} Link to comment https://forums.phpfreaks.com/topic/168465-solved-i-am-1-step-away-from-being-done-on-a-3-year-project-please-help-php-code/#findComment-888655 Share on other sites More sharing options...
scbookz Posted August 2, 2009 Author Share Posted August 2, 2009 so how do i make $oscmatches array into individual parts or numbers listed as a variable $test then i am done the code works when $test = number and my pages look right Link to comment https://forums.phpfreaks.com/topic/168465-solved-i-am-1-step-away-from-being-done-on-a-3-year-project-please-help-php-code/#findComment-888656 Share on other sites More sharing options...
Mardoxx Posted August 2, 2009 Share Posted August 2, 2009 I edited the code again, try that Link to comment https://forums.phpfreaks.com/topic/168465-solved-i-am-1-step-away-from-being-done-on-a-3-year-project-please-help-php-code/#findComment-888657 Share on other sites More sharing options...
Mardoxx Posted August 2, 2009 Share Posted August 2, 2009 /osc/osc/osc/catalog/product_info.php?products_id doesn't return any products do you have access to http://www1.com??? (as in can you edit the php files on it?) because what you need to do is quite simple connect to database, extract ISBN THEN run your search and regex on www2 for EACH ISBN received... it's really quite simple. //edit OHHHHHHHHHHH I see what you're doing... give me 10 secs Link to comment https://forums.phpfreaks.com/topic/168465-solved-i-am-1-step-away-from-being-done-on-a-3-year-project-please-help-php-code/#findComment-888658 Share on other sites More sharing options...
scbookz Posted August 2, 2009 Author Share Posted August 2, 2009 i am still studying what you posted i have not added it yet because i am trying to get my mind around it Link to comment https://forums.phpfreaks.com/topic/168465-solved-i-am-1-step-away-from-being-done-on-a-3-year-project-please-help-php-code/#findComment-888659 Share on other sites More sharing options...
scbookz Posted August 2, 2009 Author Share Posted August 2, 2009 Invalid argument supplied for foreach() in /var/www/net/helllooo.php on line 14 --------------- foreach ($osctag as $match) { Link to comment https://forums.phpfreaks.com/topic/168465-solved-i-am-1-step-away-from-being-done-on-a-3-year-project-please-help-php-code/#findComment-888661 Share on other sites More sharing options...
Mardoxx Posted August 2, 2009 Share Posted August 2, 2009 yeah, i understand now, I'll write it for you and comment it.. thne you can read Link to comment https://forums.phpfreaks.com/topic/168465-solved-i-am-1-step-away-from-being-done-on-a-3-year-project-please-help-php-code/#findComment-888663 Share on other sites More sharing options...
scbookz Posted August 2, 2009 Author Share Posted August 2, 2009 i have access to ww1 yes Link to comment https://forums.phpfreaks.com/topic/168465-solved-i-am-1-step-away-from-being-done-on-a-3-year-project-please-help-php-code/#findComment-888664 Share on other sites More sharing options...
scbookz Posted August 2, 2009 Author Share Posted August 2, 2009 ww1 is in my server i have total control over it i have built everything from scratch 3 or 4 times now i am on this last leg one more code and i am done with adsense and everything then i am on my way to riches lol ----------------- well after this i will need to figure out google base upload of xml shouldnt be too hard though Link to comment https://forums.phpfreaks.com/topic/168465-solved-i-am-1-step-away-from-being-done-on-a-3-year-project-please-help-php-code/#findComment-888665 Share on other sites More sharing options...
scbookz Posted August 2, 2009 Author Share Posted August 2, 2009 can you just turn this return($oscmatches[1]);} into a number and i am done all i need is one part of the array to convert it to a number and i am done except for whether i use "" or ' ' or pregmatch or pregmatch all Link to comment https://forums.phpfreaks.com/topic/168465-solved-i-am-1-step-away-from-being-done-on-a-3-year-project-please-help-php-code/#findComment-888666 Share on other sites More sharing options...
scbookz Posted August 2, 2009 Author Share Posted August 2, 2009 in a quick summary i am using isbn as my description upload from my excel file whereas osc uses many variables from database i do not know mysql terminology so i try to avoid it and then i have a simple script instead of grabbing from a database i am grabbing from a .php generated page Link to comment https://forums.phpfreaks.com/topic/168465-solved-i-am-1-step-away-from-being-done-on-a-3-year-project-please-help-php-code/#findComment-888668 Share on other sites More sharing options...
Mardoxx Posted August 2, 2009 Share Posted August 2, 2009 I#m crap with regex write me an expression to capture the ISBN: <td class="pageHeading" valign="top">0324183313<br><span class="smallText">[1217]</span></td> ISBN is 10 or 13 digits, the last one CAN be an X also.. what's the excel file for? Link to comment https://forums.phpfreaks.com/topic/168465-solved-i-am-1-step-away-from-being-done-on-a-3-year-project-please-help-php-code/#findComment-888669 Share on other sites More sharing options...
scbookz Posted August 2, 2009 Author Share Posted August 2, 2009 is this a possible answer? As in Perl, you can access a value from the array inside double quotes. However, with PHP you'll need to enclose your array between curly braces. Example #4 Accessing an array inside double quotes <?php $foo = array('bar' => 'baz'); echo "Hello {$foo['bar']}!"; // Hello baz! ?> Link to comment https://forums.phpfreaks.com/topic/168465-solved-i-am-1-step-away-from-being-done-on-a-3-year-project-please-help-php-code/#findComment-888673 Share on other sites More sharing options...
scbookz Posted August 2, 2009 Author Share Posted August 2, 2009 i upload to the database via excel csv tab delimited Link to comment https://forums.phpfreaks.com/topic/168465-solved-i-am-1-step-away-from-being-done-on-a-3-year-project-please-help-php-code/#findComment-888675 Share on other sites More sharing options...
scbookz Posted August 2, 2009 Author Share Posted August 2, 2009 i do not know regex either i download oscommerce and it is automatic loading Link to comment https://forums.phpfreaks.com/topic/168465-solved-i-am-1-step-away-from-being-done-on-a-3-year-project-please-help-php-code/#findComment-888678 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.