Jump to content

elias

Members
  • Posts

    20
  • Joined

  • Last visited

    Never

Everything posted by elias

  1. Hi leute I am trying to use file_get_contents() to download and analyse a website. But it seems not to work for all webs. When I try a basic html page, the page is reproduces with the below code. But, particularly, for this web, it does not work - to try pls remove -remove- : $handle = file_get_contents("http://www.hisp-remove-anianet.tv/index.html"); print "number = $number<br />"; any guidance, welcomed :-) thanks elias
  2. Thanks guys khr2003: if that is the case, that you cannot include "parts of a for loop", then the application of include() here is worthless, as the for loop is 446 lines, and the point of the exercise was that as 400 of the 446 lines where common, I would have only like a "header" included depending on which application I needed. so, is there another neat way of achieving the same effect?: I have three or more pages of code, where, say 40 lines are page specific (and contain the beginnings of teh for loop) and 400 are common (html tables showing the results, etc). How can I use the same page for the three pages, where an if() statement sorts out which code-header I need. I am not sure if that was clear - I hope so. TIA elias
  3. ...where line 446 is the closing "}" of the for loop
  4. Hi guys and gals! I have various pages with slightly different code inside a for() loop: for ($i = 0; $i < $sn; $i = $i + 1){//first loop... $detailsp = array(); $detailsp = explode(" ", $lines[$xn]); //lots of code here..... } for ($i = 0; $i < $sn; $i = $i + 1){ //first loop... $detailsp = array(); ; $detailsp = explode(" ", $lines[$xn]); $dummy2 = array_shift($detailsp); //lots of code here..... } I would like to just make one page with an include() statement to "include" the part of the code that changes. include 'compGlob_chnk1.txt' ; //lots of code here..... } where: compGlob_chnk1.txt, contains: <?php for ($i = 0; $i < $sn; $i = $i + 1){ //first loop... $detailsp = array(); $detailsp = explode(" ", $lines[$xn]); ?> but I get an error, it seems the code "included" is not parsed as part of the for loop. any help greatfully welcome :-) cheers!! elias
  5. thanks msinternet. but is there no *more elegant* way to do this, or have I explained myself awfully? cheers elias ps. or is it the Bruce Willis avatar putting ppl off :-)
  6. Hi guys and gals! Lets see if I can explain the problem.... I have collated data from various tables to arrive a something like this: CompetitionRankShortLongTotal Barcelona2101525 Madrid1151530 Valencia3121022 I would like to sort this data by "Rank", "Short", "Long" or "Total". To that effect I have managed to introduce the data in to a multidimensional array with the keys values such as: $results[$competition]["elements"] - where $results is the multi-array $competition are teh sub arrays (madrid, barcelona, valencia) "elements" are the values of "rank", "short", "long" and "total" so, echo $results["madrid"]["total"]; // yields 30 //sorry to go on, but I need //to get my head around this still now to the question, how can I sort by "rank", say. have tried array_multisort() but found it only sorts by "row" so to speak. I can sort "Rank", "Short", "Long", "Total" or "2", "10", "15", "25" but not as I want by "column": "25, "30", "22" I have considered dumping everything back into a dummy db table, but thought "there must be a better way". also, thought of "flipping" teh table so teh rows are columns and vice-versa, but cant even begin to think how to do it, apart from creating a function() which would be a last resort. thoughts, leads, suggestions - welcome! thx and keep up the good work! elias
  7. HI Alex Yes, from teh "wayback machine", but there is so little on this topic, that your post seemed the most promising... To put you in the picture, what I am trying to do is analyse Sporting Results Data that is issued in PDF format after every competition - see attached: InfantilFemenina_FS_Scores.pdf I have copy/pasted it into a TXT document - see attached: InfantilFemenina_FS_Scores.txt I can do this every time, just create a text file and the parse through this one, and that is my current line of attack, but generally, my rule of thumb is "if it can be done manually, it should be possible to automate it", but how? :-) Anyhow, I look forward to your reply, in the meantime, I shall start on the still necessary job of parsing through the data. Cheers and TIA Elias [attachment deleted by admin]
  8. Hi Alex I know this is a little old now, but I have been searching this forum and the web for this sort of thing for ages, and there is still no clear solution. Most of the suggestions you make are to convert text/html INTO pdf, but not the other way around. Have you manipulated pdf files as you suggest? If so, I would be *really* interested to know how you've done it, as I cant find any way of doing it to date. Cheers elias
  9. excellent guys/gals! thanks, that gives me a few options to work on. take care and have a nice weekend! elias
  10. hi jesirose Thanks for your input, but how do you think I could achieve the desired effect - it must be possible. I want to have a template sitting in domain A with a database linked to it, and then I want 20 other domains, B, C, D, etc. elsewhere to all be able to call on this template so I dont have to have 20 pages and 20 data bases - there must be a way, right? cheers elias
  11. hi guys and gals! I have 20 domains which (to make life simpler) all share the same template pages and data base which reside in another domain. Since changing server, I have found that my pages that used to load at normal speeds are now taking 20-40 seconds (completely unacceptable ) I have narrowed down the problem to this one line: include("http://www.mydomain.com/template.php?site_id=$site_id"); where $site_id are my 20 domains - eg: ItemA, ItemB, etc. Basically my 20 index pages sit in their own domains and call my templates which reside in www.mydomain.com It used to work, but now as I said, it takes forever to load, and I know this is the culprit because if I just call http://www.mydomain.com/template.php?site_id=ItemA from my browser it comes back instantly. Any ideas...... I have tried include and require, but it does not seem to make a difference (and by the way, what are the difference between these two commands) Anyhow, any pointers would be greatly appreciated!!! cheers and have a nice weekend elias
  12. Hi guys long time no speak... I have a code which allows (well it is supposed to) let you upload photos, but I get this error code everytime I try it: and the mentioned line is this one: anyhow, th funny thing is that the data is recorded in the database, as if the photo has been loaded and afterwards the gallery shows as if it has a photo loaded, but there is nothing there. I have upgraded the permissions in the /temp and /images folder, but this had little effect. Can anyone point where I could look for some solutions TIA elias
  13. Hi Ray Thanks a bunch for the explanation, I will do some further studying to make sure I undestand it thoroughly. I just did not know where to turn. Thanks again and have a good one!! tahiche
  14. Hi guys and gals I am baffled by the inability to send variables accross two pages through a form... This is a little experiment I set up to see exactly what was going on: Form Page: [code]                     <form action="test_print.php" method="post">                                <input type="text" name="site_id" value="something" size="30">                     <input type="submit" value="Send">                      </form> [/code] Print Page (test_print.php): [code]             $site_id = $_GET["site_id"];             print "$site_id"; [/code] And the result is a blank page. Then I tried directly on the browser: [code]http://www.domain.com/test_print.php?site_id=something[/code] and that worked - I got the word "something" printed. I have to add that I have moved server and all these pages worked before. Also, someone has already suggested the use of $_GET["site_id"]; - which I dont know exactly what it does, but it does seem to make it work when variables are passed from one page to the other via the URL. Can someone shed some light as to what is going on and how to fix it. TIA tahiche
  15. [!--quoteo(post=349390:date=Feb 25 2006, 10:48 PM:name=hitman6003)--][div class=\'quotetop\']QUOTE(hitman6003 @ Feb 25 2006, 10:48 PM) [snapback]349390[/snapback][/div][div class=\'quotemain\'][!--quotec--] You have to login to use cPanel, and therefor access your logs. Because of that you will not be able to directly access them from php, at least not to my knowledge. You may consider looking more indepth at cURL, as I am not terribly familiar with it's full capabilities. [a href=\"http://us3.php.net/manual/en/ref.curl.php\" target=\"_blank\"]http://us3.php.net/manual/en/ref.curl.php[/a] [/quote] Hi hitman6003 Thanks for your help, but unfortunately I have no access to the PHP server - I am just a mere paying customer, and hence I have no possibility to install any extra libraries etc. as stipulated in your link. Also, I am aware that the cPanel needs user access, but I thougth that once I had logged-in into my cPanel area, I did not need to reenter my user name and password again, in fact once I am in a session in my cPanel area, I can copy/paste the URL of where the raw logs are and I can access them with my browser with no problem. I guess the question arises if from where the code is being run, does it have access to my session...?? dunno, and this is where my knowledge hits a wall. Basically, for anyone else reading this post anew, once in a cPanel session, I can access the raw logs file: [a href=\"http://www.domain.com:2082/getaccesslog/accesslog_domain.com_2_25_2006.gz\" target=\"_blank\"]http://www.domain.com:2082/getaccesslog/ac...om_2_25_2006.gz[/a] but the code I have prepared to read this file cannot. Any other ideas, like do any "server-masters" know which is the actual path of this file, like I tried: "/home/mydomain/public_html/getaccesslog/accesslog_domain.com_2_25_2006.gz" but it was clearly wrong... through my FTP access I cant find (I have no access to) the directory "getaccesslog" but does anyone know where these raw logs reside??? cheers and TIA again elias
  16. Hi k4pil What comes to mind is to have one while loop for the main table as you say, and then within that loop, when you come to the Name, Surname and PHone fields, you start another while loop, within the first one. In this way, for every "hit" in the first loop, the second loop fills out the remaining fields from the other table. good luck elias
  17. Hi guys and gals I hope you are all enjoying this weekend. I am messing around with my raw logs and am having a bit or a problem accessing them in the first place... I am doing tests with the following code: [code]$handle = fopen("http://www.domain.com/uploads/accesslog_domain.com_2_25_2006.gz", "r");[/code] which works fine when I manually place the logs in this "uploads" directory, but that is not where they normally reside, when I go to my cPanel and ask to view them, I am sent to: "http://www.domain.com:2082/getaccesslog/accesslog_domain.com_2_25_2006.gz" to download them. What I would ideally want is for my script to access the logs directly here, hence something like this is what I tried: [code]$handle = fopen("http://www.domain.com:2082/getaccesslog/accesslog_domain.com_2_25_2006.gz", "r");[/code] But as luck would have it, it gives me a error something like: [i]Warning: fopen(http://www.domain.com:2082/getaccesslog/accesslog_domain.com_2_25_2006.gz) [function.fopen]: failed to open stream: HTTP request failed![/i] So, I imagine that the php code cannot access the file because it is referred to with port number... and here I am lost. Does anyone know how I could access the file from teh script - I can dowload it if I just copy and paste the [a href=\"http://www.domain.com:2082/getaccesslog/accesslog_domain.com_2_25_2006.gz\" target=\"_blank\"]http://www.domain.com:2082/getaccesslog/ac...om_2_25_2006.gz[/a] url, so there is no problem with the file as such, its the script's ability to access it. Anyhow, I hope someone can point me in the right direction. take care and all the best elias
  18. HI guys Thanks for your replies... IT WORKS!!!! ... but not due to quotes... I tried every combination of quotes, sigle, double, normal an funny accent ones... but nothing... For the record and for future reference, the problem was a simple administrative coq-up! In my cPanel administration area, I created the database, then I created the table, then I created the user... and I thought that was it... but later on I realised I had to **Add User to Db**!! This solved the problem and as expected, the result now is: [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]You are connected to a mySQL database!There are number of rows: 2 I am so pleased I can continue my project. Thanks again for reading and keep up the good work. Elias ... I'll (probably) be back :-)
  19. Hi guys I am absolutely tearing my hair out about this one. I have done checks and double checks but cant fathom it out - I got to the point that I think there is a problem with the PHP installation at my server - but I have come to learn that something very insignificant can make the code falter and the usual response is "blame the tools". I am creating a new website and have just created a very simple one-liner database. I just want to access this database, read the row off my one table and come back and report that everything is ok. The row has 10 entries and through my cPanel phpMyAdmin I can access and perform the query: SELECT * FROM general WHERE `header` LIKE 'header' to get a the row details returned to me. (I even tried misstyping "header" to get a "MySQL returned an empty result set" So, so far so good. I seem to have created the table correctly and a row of data that I can access from the cPanel Admin tool. The problem starts when I try to access and retrieve data from my website - this is my code: mysql_connect ("localhost", "user", "*********") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("mydatabase"); print "You are connected to a mySQL database!"; $result = mysql_query("SELECT * FROM 'general' WHERE `header` LIKE 'header'"); $numrows = mysql_num_rows($result); print "There are number of rows: ".$numrows; The result is very depressing: [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] You are connected to a mySQL database! Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/mydomain/public_html/indexphp2.php on line 21 There are number of rows: So as you can see, it keeps on saying that the argument supplied to mysql_num_rows() is not valid... What am I doing wrong - clearly the fact that it prints the first line, it (seems) to mean that it is connecting to the database, but it cant peform the query... Could there be a problem with my server, or the database or the table - what do people suggest I try next. Thanks for yoru time. Elias
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.