Jump to content

physaux

Members
  • Posts

    208
  • Joined

  • Last visited

    Never

Everything posted by physaux

  1. hey guys, I have a quick question again. How can I retrieve JUST <title>THIS TEXT</title> from a URL, using php? I would open the file, or do a HTTP request, then search for the string with regex, but that would be really inefficient because I only want the title data. Thanks in advance!!
  2. Ok i solved the problem, it was syntax /dir is BAD /dir/ is BAD dir/ is GOOD
  3. I did that, but I still get the same errors. Could it be that i am running it in XAMPP? I could upload it to my server, but the whole point of what I'm doing is just to batch create the folder structure. Any other ideas?
  4. Warning: mkdir() [function.mkdir]: Permission denied in /Users/../FileReader.php on line 80 //Line 80 below mkdir("/".$classname); //$classname is "DOG" How can I fix that?
  5. Hey guys, I got a big project ahead of me, I was hoping someone could point me in the right direction. So I have a text file, that I downloaded. It is formatted like so: ID [TAB] NAME [TAB] RANK1 [TAB] RANK2... ID [TAB] NAME [TAB] RANK1 [TAB] RANK2... ID [TAB] NAME [TAB] RANK1 [TAB] RANK2... ID [TAB] NAME [TAB] RANK1 [TAB] RANK2... ID [TAB] NAME [TAB] RANK1 [TAB] RANK2... ...//and so on What I want to do is essentially "batch process" this text file, to create the following folder structure: The main folder would have different folders inside of it, one for each "RANK1". In of these folders, there would be another folder for "RANK2" ex: ID [TAB] NAME [TAB] dog [TAB] charlie... ID [TAB] NAME [TAB] dog [TAB] woof... ID [TAB] NAME [TAB] cat [TAB] meow... would create: [dog], [cat] inside of [dog], there would be two folders; [charlie],[woof] inside of [cat], there would be one folder; [meow] Get it? Ok, Now the last part. Inside of each final folder, I want to place a text file with some text. Ex: in [dog][charlie] I would place index.php, contents = "THIS IS CHARLIE THE DOG" MY IDEAS: I would read the text file line by line, then "explode" each line by the "tab" into an array, which I would then analyze. How would i go from there? Thanks! Could anyone point me in the right direction? Ty
  6. Hey guys, I was wondering if someone could advise me, here is my situation: First Question: I have my main web folder, and then 10 folders. Then in each of these 10 folders, I have 10 more folders. Ex Domain.com/F8/F1 Domain.com/F8/F2 So, I will have many pages, and they will all have similar layout. I want to do this with php include() function, the problem is that I don't know how to "reference Up a level", like say "footer.php" was located in: Domain.com/includes/footer.php How would i refer to that from say Domain.com/F8/F2/index.html Would it just be absolute path? Or is there a better way? Second Question: How can i pass the current path to a function? Like i mean, I want to have each file from each of those folders call a function like so: In file- Domain.com/F2/F3/index.html Call Function- Function(F2,F3); How can i "send" the data of the current folder in a function? This way I could have really efficient pages, because they would be generated from a database and just one easy-to-edit file. Or again, is there a better way? Thanks for any insight!!
  7. Hey guys, I was wondering if someone could advise me, here is my situation: First Question: I have my main web folder, and then 10 folders. Then in each of these 10 folders, I have 10 more folders. Ex Domain.com/F8/F1 Domain.com/F8/F2 So, I will have many pages, and they will all have similar layout. I want to do this with php include() function, the problem is that I don't know how to "reference Up a level", like say "footer.php" was located in: Domain.com/includes/footer.php How would i refer to that from say Domain.com/F8/F2/index.html Would it just be absolute path? Or is there a better way? Second Question: How can i pass the current path to a function? Like i mean, I want to have each file from each of those folders call a function like so: In file- Domain.com/F2/F3/index.html Call Function- Function(F2,F3); How can i "send" the data of the current folder in a function? This way I could have really efficient pages, because they would be generated from a database and just one easy-to-edit file. Or again, is there a better way? Thanks for any insight!!
  8. Hey guys, i read http://weblogtoolscollection.com/regex/regex.php, about an hour ago, so i am really new to regex. My question is, if i had a string, and i wanted to count how many times "<b>" appears, which function would i call for this? I know how to create the "patterns" and such, just not which function to use. ex: preg_something? Any pointers greatly appreciated!!
  9. Hey guys, is there any way for me to get the source code of a website as a variable for me to work with? Ex: $url="http://www.google.com" $sourcecode=magicfunction($url); //so that i could manipulate it or whatever thanks!
  10. Ok guys, i need some help with this one. I am going to be getting a large string, like 10-20 paragraphs. I will also have an array or words that i would like to search it for. Ex SearchString[1]="cows", ... How could i implement this with php? I would basically want to do a word count, but i want to make the code myself. Can anyone help me? ty!
  11. My error: Warning: fopen(NameFile_dogs.txt) [function.fopen]: failed to open stream: Permission denied in /Users../Sites/nametest/index.php on line 43 can't open file Here is the relevant code: <?php //... $DirectionsFile = "NameFile_".$species.".txt"; $fh = fopen($DirectionsFile, 'w') or die("can't open file"); // THIS IS LINE 43 //... fwrite($fh, "Scrubs\n"); fwrite($fh, "Snoopy\n"); //... if(isset($fh)){ fclose($fh); } ?> Anyone know how to fix this? I have no clue how to set/vary php/other permissions for my files. Also it is the first time i tried this code, so i know the filename does not exist yet. Other than that, i'm lost! Any1 have a clue??
  12. My code: $rawstring= "Something9123toasdkln897"; $explosionarray= array(); $explosionarray=explode("to", $rawstring);//THISLINE. And i get this: Notice: Array to string conversion Here is an example from http://php.net/manual/en/function.explode.php $pizza = "piece1 piece2 piece3 piece4 piece5 piece6"; $pieces = explode(" ", $pizza); echo $pieces[0]; // piece1 i could swear that i am doing the exact same thing, but i get a "Notice"!! Any way to get rid of it???
  13. I am having problems splitting up a string.. I am going to be having a value, $inputstring. Examples follow the following pattern: support1at2set support3at9set support2at7set xtra8set master4set.. meaning: it will always be "$text"."number"."set" OR "$text"."number"."$text2"."number"."set" How can i split up the string so that i can extract it into parts, variables? Example: support3at4set ---> $firststring="support", $firstnumber=3, $secondstring="at", $secondnumber=4, $thirdstring="set" i cant figure it out, anyone knows how to do this?
  14. Ok well i figured it out, i just accessed the image directly in my URL, right after the previous page loaded, preserving my session. I see many errors, and im off to more work!
  15. i have ini_set('display_errors',1); error_reporting(E_ALL); in both files, right under first line, which has <?php tag as you said. However i still am not seeing any errors. Here i am going to show you summarized code of the captchaimage.php file: <?php ini_set('display_errors',1); error_reporting(E_ALL); session_start(); $OrderOfOperations = $_SESSION["OrderOfOperations"]; $ImageFormat= $_SESSION["ImageFormat"]; $printcoordinates= array(); class Blogfarmimage { function Blogfarmimage($width,$height) { $image = @imagecreate($width, $height) or die('Cannot initialize new GD image stream'); //... header('Content-Type: image/jpeg'); imagejpeg($image); imagedestroy($image); } } if(isset($OrderOfOperations)){ //... $captcha = new <strong>Blogfarmimage</strong>($width,$height); } ?> And it is called from index.php with: echo '<img src="captchaimage.php />'; Any clue how i could make this show me errors? Maybe viewing errorlogs? (if so could you please tell me how to do that) thanks!!
  16. From what i understand, you want to be able to get and use the search query that people who google'd to your website used, is that right? If so, from what i've heard people just get this data from the meta data of the referring page. But i don't really know how to do that myself, so you'd have to hope som1 else here does, or read up. But i am 99% sure that is how it is done.
  17. Hello again guys, this time i have heavily modded my captcha.php file, and when i refer to it as such: echo '<img src="captchaimage.php />'; My image doesn't come out normally... Which is predictable, But i do not see any errors on screen, i just want to be able to see the errors that this page generates, because it must have some. So does anybody know how i can do this? Thanks!
  18. for this function, http://php.net/manual/en/function.imagefilledellipse.php. where are the x- and y- coordinates measured from? I assume top left but the page doesn't explicitly say that, so i wanted to make sure with someone.
  19. Hey guys, i have a main file, index.php i also have a file called captchaimage.php I have used it before, so i know everything works and all. I am making a quick new php functionality, and i need to send data from index.php to captchaimage.php. I was just wondering if i am missing anything? Here is my code: <?php session_start(); //... $_SESSION["OrderOfOperations"]=$OrderOfOperations; echo '<img src="captchaimage.php />'; //... session_destroy(); ?> And in my captchaimage.php file, <?php session_start(); $OrderOfOperations = $_SESSION["OrderOfOperations"]; if(isset($OrderOfOperations)){ print_r($OrderOfOperations);// idk why i did this, can't see print anyways lol } //... session_destroy();// DO I need this here? ?> So is that everything i need? and do i/ should i destroy the session in the second file? Thanks!!
  20. Hey guys, i am having a really annoying problem... Basically, my array is never set on the global scale... check out the code below <?php //functions defined here //... $OrderOfOperations= array(); //... createorders(); ?> That is my declaration, and call to a function. Here is the function which is called, "createorders()": <?php //... global $OrderOfOperations; //... if(didhappen($chance)){ echo "it did happen, size of array now is ".count($OrderOfOperations)."<br>"; createnames($index, $index2, $index, $index3); updateorderofoperations($index, $index2, $index, $index3);//Calls another method ?> And here is finally the code for the function "updateorderofoperations()": <?php global $OrderArray; global $OrderOfOperations; $temptext="OrderArray: ".$OrderArray[$site1index1][$site1index2]["Name"]." sends to ". $OrderArray[$site2index1][$site2index2]["Name"]; array_push($OrderofOperations, $temptext); //THIS IS LINE 172 echo "From inside function<br>"; ?> when i run the code, i just get the following output looped: Warning: array_push() expects parameter 1 to be array, null given in /Users/../includes/functions.php on line 172 From inside function it did happen, size of OOO is 0 So i can see that the method was called successfully, because of the "from inside function" text. I do not understand what is wrong to cause my error though, as well as why my master array does not accumulate values. Am i not adding to an array properly? Idk So, anyone see any problems? Please help me out
  21. Yea without code, i cannot help you. I'm new too, but i just asked virtually the same question like half an hour ago heh. check this out it might have what you need http://www.phpfreaks.com/forums/index.php/topic,273009.0.html
×
×
  • 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.