Jump to content

claudiogc

Members
  • Posts

    13
  • Joined

  • Last visited

Everything posted by claudiogc

  1. Good evening! I'm trying to use libcurl with php in my Debian and apparently it is not working unless i'm doing something wrong. So, when i enter with "aptitude search libcurl", my output is: The "i" means it is installed, i believe. Then, i read this tutorial and changed a little bit a code posted in it. http://php.net/manual/en/curl.examples.php <?php function cURLcheckBasicFunctions() { if( !function_exists("curl_init") && !function_exists("curl_setopt") && !function_exists("curl_exec") && !function_exists("curl_close") ) return false; else return true; } if( !cURLcheckBasicFunctions() ) { echo "UNAVAILABLE: cURL Basic Functions"; } else { echo "cURL is working fine!"; } ?> I believe if libcurl were installed in my system i should see "cURL is working fine", but my output is "UNAVAILABLE: cURL Basic Functions". So, what is wrong?
  2. Hello, people! I was watching some php tutorials in youtube and, in a video, the guy was showing how put php script inside html code. I would like to know why in the following code he didn't use only one php script? 1- Code used in the video: <html> <body> <?php $color = $_GET['clr']; ?> <b><font color="<?php echo $color;?>">This is a test.</font></b> </body> </html> 2- Modified code by me to test with one script: <html> <body> <?php $color = $_GET['clr']; echo "<b><font color=\"$color\"> This is a test. </font></b>"; ?> </body> </html> Is his code more correct(with two scripts)? Why?
  3. Did not understand this part. "PHP try and convert the first operand to a number" The number 2? Because the real first operand of the operation, number 4, already is part of the other string. What happened to "+"? "but since the string is not a valid number you get zero." What string?
  4. Problem fixed. Thanks! If is the case why is he not showing "Addition: 4"? Because he should concat "Addition" with "4" and after that i have no idea.
  5. Hey, guys! Why the output of my code in both "echo" is only the number "2"? <?php $x = 4; $y = 2; //Addition. echo "Addtion: " . $x + $y . "<br>"; echo 'Addtion: ' . $x + $y . '<br>'; ?> Thanks!
  6. Wow! LOL. I should have seen that too. Thank you very much for your help.
  7. Thank you, guy! I did what you, Ch0cu3r said and look what i get: Whe i try to execute this code: <?php ini_set('display_errors', true); error_repoting(E_ALL); $f = fopen("/var/www/filetest.txt","w+"); fwrite($f,'is just a test'); fclose($f); ?>
  8. But why even if i change the path to /var/www/test.txt he doesn't create him? If i change this to just the file name i don't know where he is created because /var/www/ is "empty", only .php files are there.
  9. Who is the webuser in my case? Me? Apacha2? How can i chage these permissions to access/read/write on a dir outside of my weboot?
  10. Thank you for your answers, but i don't understand one thing. I made a javascript that reads a webpage source code and puts in an array all urls of pictures of this page. Then i asked in other forum(javascript forum) how i could download these pictures. They said to me i could do that using PHP because it was better suited to this task, as JavaScript only has limited access to the local file system. And any server-side language (except maybe Classic ASP) is better suited for downloading files. That's why i asked the question 1, because one way to find what i whant in a webpage sorce code is using getElementByClassName(). But now, i don't know who is right, you or them because they said to me to use PHP for do what i want, but you said is not possible. Actually i want to learn PHP for other things, but i need a motivation and make this "program", that downloads all pictures of a webpage is a good motivation for me.
  11. But i did what you said(specify the full path to your home directory) and still not working! <?php $f = fopen("/home/rob/test.txt","w+"); fwrite($f,'is just a test'); fclose($f); ?> The same thing with the following code. <?php $f = fopen("test.txt","w+"); fwrite($f,'is just a test'); fclose($f); ?> Maybe he is creating this file in other place than /var/www/ or /home/rob/
  12. Hey, guys, in the following code, why i cannot see my ~/test.txt file? It seem he is not doing what i want, to create a .txt file with 'is just a test'. I'm using Debian. <?php $f = fopen("~/test.txt","w+"); fwrite($f,'is just a test'); fclose($f); ?> Thank you!
  13. Hello! I'm newbie in PHP(started 3 days ago), and i have two questions about the same topic, i hope you can answer me. 1- Is there methods in php for interaction with webpages as javascript, as they simulate a user interacting with these pages? For example, the method click () or the getElementsByClassName () for you to find something specific on the page. There are methods that do this in php? 2- To interact with a website using a sript (to click on links or save the url of pictures in an array) i start "JavaScript Scratchpad" Firefox with Shift + f4 and then it runs the script there, is just be on the page i want. If i want to do something similar in php, how can i run this script on my browser or is it done another way? Thanks!
×
×
  • 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.