Jump to content

aye

Members
  • Posts

    13
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

aye's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi, I have a class that takes care of the MySQL connection. The constructor looks like this (first line): (yes, it's PHP4) function MySQL($database = $this->database) where $this->database contains the default database name. However, this doesn't seems to work (don't get why, doesn't seem like invalid syntax). When executed I get the following error: Am I doing something wrong, or is it just not possible to declare an optional function argument's default value as a variable? I know I could do something like this (but it doesn't seem like the optimal thing to do): function MySQL($database = NULL) { if($database == NULL) $database = $this->database; (...) Any help would be very much appreciated!
  2. (bump) still has the same problem.. any help with this would be ver very nice . I've searched google for "[function.gzfile]: failed to open stream: HTTP request failed!", but there was no results! guess im the only one having this problem
  3. A small update: tried getting the data with file_get_contents() and file() instead and then it works fine (though gzipped). So it is obviously nothing wrong with the communication.. this error is driving me mad could it be that the host doesn't allow reading the file gzfile or something?
  4. Hi everyone! Im trying to read a gzipped file on another webserver, but sometimes I am given the HTTP request failed error ([function.gzfile]: failed to open stream: HTTP request failed!), even though the file is still readable in the browser.. does anyone know what the cause of this error is and how it can be fixed? Some help with this would be great
  5. aye

    crontab help

    wow, thank you so much!! it works great! youve really made my day now
  6. aye

    crontab help

    ah, so.. if i would use include or require, i have to write the full path, like require_once("/etc/crawler/config.php")?
  7. aye

    crontab help

    ok, i put a simple mysql query in my script to see if it actually was running and yes, youre right, it is running.. anyhow, its an indexing script, looking for links on the net to certain files and then downloading them to the server. its quite an intricate script with above 1000 lines of code (in 13 separate files), so i dont feel like posting it here . ok, so the script is running, but normally it indexes about thousand files / day with wget, but now, after two days running directly from cron, it hasn't indexed a single file! could there be any port problems when not run from the webserver or something?
  8. aye

    crontab help

    yeap, used 'which php' to get the php path. file permissions is 755 this is the cron output: Feb 13 15:45:01 c80-217-170-126 crond[31151]: (root) CMD (php /etc/crawler/index.php) ok, ill change that. not very good at linux directorys
  9. aye

    crontab help

    hi, im using a dedicated server and ive access to all directorys. sorry if i was unclear, but when running the script from wget, im running the script from a different location (/var/www/html/crawler/index.php). in any case, if i run "php /etc/crawler/index.php" from terminal, the script runs as it should, which confuses me even more; isnt that the exact line cron should run as well?
  10. aye

    crontab help

    hallo, for the last couple of days i have been trying to set up a cronjob to run a php script bur failed miserably.. ive tried all kind of things, from which ive read should work, but it does NOT. or.. not for me at least . ive also tried using wget, to run the script from the webserver, which works fine (so there is, probably, not any problem with my cron settings), but it feels more convenient running the script directly through cron rather than having wget fetch the website (takes up more resources as well maybe? after all i will run my script once every five minutes..). Ok, i will try to list all the things, that ive tried.. 1. */5 * * * * php -q /etc/crawler/index.php in crontab (dont know about that quite flag, read somewhere that you should use it with the command line version of php, which i have) 2. */5 * * * * php /etc/crawler/index.php in crontab 3. */5 * * * * /usr/bin/php /etc/crawler/index.php and */5 * * * * /usr/bin/php -q /etc/crawler/index.php in crontab 4. */5 * * * * /etc/crawler/index.php in crontab and #!/usr/bin/php -q / #!/usr/bin/php on the first line of the php script ok, now im quite new to running php scripts through cron (actually its my first time ), so ive probably forgotten to add something.. any ideas? help would be greately appreciated
  11. genericnumber: thanks for the tip, got an other error now though: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '<last keyword>(id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id), link VARCHAR(50), tim' at line 1. dgiberson: tried putting a space between them but there was no change :( here's the code that inserts everything into mysql anyhow: [code]function endElement($parser, $name) { global $insideitem, $link, $conn, $tcount; if ($name == "ITEM") { if(!mysql_num_rows(mysql_query("SHOW TABLES LIKE '" . $_GET["q"] . "'"))) { mysql_query("CREATE TABLE " . $_GET["q"] . " (id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id), link VARCHAR(50), time INT)",$conn) or die(mysql_error()); } mysql_query("INSERT INTO `" . $_GET["q"] . "` (link,time) VALUES ('" . $link . "','" . time() . "')",$conn) or die(mysql_error()); $tcount++; $link = ""; $insideitem = false; } }[/code] was some time i did php, so i have probably made some newby mistake  :)
  12. hey, im designing an RSS indexer for certain web pages. the idea is to store recently used keywords and their matches in a mysql table (the name of the table=search keyword and the matches inside the table) to speed up the search, however ive now come across two errors that i cant get rid of... 1. if a search returns many matches (~>20), the php script will exit, saying "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near <INSERT INTO values>".. is there any limit of how many mysql queries one can make under a short session and can i increase this limit somehow? 2. when searching for a word containing a number (ie 123), i get the following error "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '123(id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id), link VARCHAR(50), time INT)' at line 1" oh, and i have one more problem.. this ones not about mysql though... when searching for multiple keywords, i get the following error "Warning: fopen(<search directory>/<search query>) [function.fopen]: failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request in /var/www/html/search.php on line 58.. that is when trying to read the rss feed from other search engines (for example feeds farm would give http://www.feedsfarm.com/s/my search&format=rss, in other words - it seems like fopen can't open path names that has spaces in them.. is there any way you can get around this?) thanks for your help :)
×
×
  • 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.