Jump to content
Killersites Forums


  • Posts

  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

FreeBenzine's Achievements


Newbie (1/14)

  • First Post Rare
  • Collaborator Rare
  • Conversation Starter Rare
  • Week One Done Rare
  • One Month Later Rare

Recent Badges



  1. Seems nobody replies in this site
  2. Hi, I am trying to download xml file from URLs containing feeds using CURL using the following code. The code downloads the xml file for LINK1 (below, for RSS feeds). The code downloads a HTML file (instead of xml) for LINK2 (below, for Atom feeds). If I open LINK2 in a browser I can save it as a xml file. I do not understand why the code cannot download the xml file for LINK2. Any help will be highly appreciated. //$url = 'https://rss.sciencedirect.com/publication/science/00221694'; //LINK1 $url = 'https://onlinelibrary.wiley.com/feed/25780727/most-recent'; //LINK2 $curl = curl_init($url); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl,CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20080311 Firefox/'); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); $resp = curl_exec($curl); curl_close($curl); $myfile = fopen('x.xml', "w") or die("Unable to open file!"); fwrite($myfile, $resp); fclose($myfile);
  3. Hi, I am developing a php-mysql website hosted in an apache. The site is down since yesterday for my IP address, whereas it is visible elsewhere. The web hosting company said they do not see any problems and my IP is not blocked by them. The problem has occured before and was solved by itself after a few days. I simply do not understand the reason behind it. Annoying as I have to stop working on the site till it is restored. Please help. Cheers.
  4. How can I explode the following string: The first "baby boy" was naughtly,cute into array("The", "first", "baby boy", "was", "naughty", "cute") So that the text in quotation is treated as a single word. In addition I would like to split on commas and spaces.
  5. Hi, I am working on a script to allow anonymous users to upload files. I started with this simple code, which sadly I cannot make to work: <?php $uploaddir = 'uploads/'; $uploadfile = $uploaddir . basename($_FILES['Upfile']['name']); if (move_uploaded_file($_FILES['Upfile']['tmp_name'], $uploadfile)) { echo "File is valid, and was successfully uploaded.\n"; } else { echo "File uploading failed.\n"; } ?> The corresponding form is: <form name="upload" action="Upload.php" method="POST" ENCTYPE="multipart/formdata"> Select the file to upload: <input type="file" name=Upfile"> <input type="submit" name="upload" value="upload"> </form> I have not yet included the security codes, still it does not work. The message I receive is: "File uploading failed". The server does allow anonymous uploads. Do I need to edit the .htaccess file? Any tips will be greatly appreciated. Is there some better guide than http://www.scanit.be/uploads/php-file-upload.pdf on the security of file uploads? Cheers
  6. Thanks. I called the file MyVar.inc.php containing my variables as: <title> <?php include ("CSS/MyVar.inc.php"); echo $Page4_2Title; ?> </title> but sadly I cannot get the php variables in subsequent lines of the same index.php. Am I making any mistake?
  7. Hi, My index.php consists of several Includes associated with several DIVs and each Include file is a php file located at a sub-folder. Typically an include file looks like: <div id="CentralDiv"> <?php include ("Research/Publication/MainDIV/IncludeMain.php"); ?> </div> <div id="RightDiv"> <?php include ("Research/Publication/RightDIV/IncludeRight.php"); ?> </div> <div id="FooterDiv"> <?php include ("Research/Publication/FooterDIV/IncludeFooter.php"); ?> </div> As I am in the beginning stage of the design so I do not know for sure the folder/page name that will be there finally. So I want to use the pathnames as variables stored in a file 'MyVar.inc.php' - so that if page names are changed then I do not have to edit all the index.phps. I understand that one option would be to have include("MyVar.inc.php") in every time I call an Include - but that does not sound smart. Is there a way that I can call all the variables stored in MyVar.inc.php anywhere in the index.php? How can I use variables stored in MyVar.inc.php for <Title> and <body id= > ? ALSO: Is it a right approach in web design - or I am making some mistakes? Any help will be appreciated.
  8. Thanks, but I still have a few questions. 1. About index.php: You are absolutely right that there is no point using 'IncludeMain.php' as this page is not going to be included anywhere else. I will correct that. I am still curious about your comment: "Personally, I wouldn't code the site the way you have above in sample #1". As I am a beginner I would like to know what alternative I can do. 2. When all subpages are index.php (each with an include menu.php) then each time a page is loaded the menu.php is re-loaded (I think). Is it not a bad design? 3. Thanks for the codes for active menu item. Is it not possible to show the active menu just with the CSS link styles (hover/active/visited)? Thanks in advance.
  9. I am developing a website using PhP includes. Each folder and sub-folder pages are ‘index.php’ with the following structure: <div id="container"> <div id="TopDiv"> <?php include ("TopDIV/IncludeTop.php"); ?> <div id="NavigationDiv"> <?php include ("Menu/IncludeMenu.php"); ?> </div> <div id="CentralDiv"> <?php include ("MainDIV/IncludeMain.php"); ?> </div> <div id="RightDiv"> <?php include ("RightDIV/IncludeRight.php"); ?> </div> </div> Naturally, for sub-pages the “CentralDiv” and “RightDiv” contains the php pages from appropriate folders. My questions: 1. The above works cool but I’m not sure whether this is the right way of doing things. 2. I feel that when a menu item is clicked then the content of ‘TopDIV” and “NavigationDiv” are re-loaded. 3. A related problem is that I cannot keep a menu item with an ‘active’ status. I think it does not show the ‘active’ status as the content of the “Navigation” DIV is loaded every time a menu item is clicked. An ALTERNATIVE could be: <body> <div id="Navigation"> <a href="?go=home">Home</a><br /><br /> <a href="?go=page-1">Page 1</a><br /> <a href="?go=page-2">Page 2</a><br /> <a href="?go=page-3">Page 3</a><br /> </div> <div id="content"> <?php $default = "content/home.php"; if (isset($_GET['go'])) { switch ($_GET['go']) { case "page-1": include("content/page1.php"); break; case "page-2": include("content/page2.php"); break; case "page-3": include("content/page3.php"); break; default: include($default); } } else { include($default); } ?> </div> </body> My questions for the alternative: 1. Is it a better way of doing than the first approach? 2. A related problem is the URL looks crazy (with “?go....” etc.) Any advice will be appreciated.
  10. Hi, Certainly I have the index.php file in the folder. For example, in the folder for the file /news/index.php the link is to /news/. And of course the folder contains the file index.php file. I have configured to have index.php as the default page. Everything works fine as long as the links are made to the index file; for example, /news/index.php. If the link is made to /news/ then it does not work. My original post says that 'redirect' to remove index.php/index.html works but still the links are basically to the index.php file. The extension of the URL can also be seen when the mouse hovers over the link. For example, look at the following link: http://www.unesco.org/en/education Is there any other solution? Cheers.
  11. Sorry I came back to the issue again as I could not resolve it! As newseed suggested I removed 'index.php' from the navigation links (For example, from /news/index.php to /news/) but I receive 403 error. How could I remove index.php from my URL ?(I would also like to remove it from the links so that when the mouse hovers the viewer does not see the 'index.php' part). Cheers
  12. Thanks a lot everyone for the support, getting addicted this site. I'm moving ahead with php.
  13. Hi, I have several DIV elements and I am mainly calling html includes inside the DIV elements. In some occasions I need to use php includes in some DIVs. Here is my index file, I hope that it is understandable. Comments will be welcome. The index file when saved as shtml works fine as long as there are only html includes. If I have php includes it does not work. Changing the extension to php allows the php include to work but the html includes do not work. Any suggestions will appreciated. Thanks in advance. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>Go Global</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="GGStyleSheet.css" rel="stylesheet" type="text/css"> </head> <body> <div id="container"> <div id="TopTopDiv"> <!--#include virtual="IncludeTop.html" --> </div> <div id="LeftDiv"> <div id="LeftmenuDiv"> <!--#include virtual="IncludeLeftMenu.html" --> </div> <div id="BottomofMenuDiv"> <!--#include virtual="IncludeBottomofMenu.html" --> </div> </div> <div id="CentralDiv"> <?php include("test.php"); ?> </div> <div id="RightDiv"> <!--#include virtual="IncludeRight.html" --> </div> <div id="FooterDiv"> <!--#include virtual="IncludeFooter.html" --> </div> </div> </body> </html>
  14. Changing the file extension to xxx.php helps in invoking the php include but the html includes (e.g. the menu) do not work. Any solutions?
  15. Hello, My page has several html includes. The index page with html does not work, and had to be made shtml to work. Now i need to include php inside a DIV of the shtml file. The include php works quite ok with html but fails with shtml. Could you kindly give me advice how to include php inside a DIV of shtml? Tim
  • Create New...