User Tools

Site Tools


c:nmp:web_development

This is an old revision of the document!


Table of Contents

Web development

<VirtualHost *:80>
	ServerName localhost
	DocumentRoot D:/Wamp64/www
	<Directory  "D:/Wamp64/www/">
		Options Indexes FollowSymLinks MultiViews
		AllowOverride All
		Require all granted
	</Directory>
</VirtualHost>

<VirtualHost *:80>
	ServerName nmp-project
	DocumentRoot d:/www/nmp-project
	<Directory  "d:/www/nmp-project/">
		Options Indexes FollowSymLinks MultiViews
		AllowOverride All
		Require all granted
	</Directory>
</VirtualHost>

HTML

index.php
<?php
echo "hello world";
?>
index.php
<?php
echo "hello world";
phpinfo();
?>
index.php
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
 
<h1>This is a Heading</h1>
<p>This is a paragraph.</p>
 
<?php
echo "<p>This is php part.</p>";
?>
 
</body>
</html>
index.php
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
 
<h1>This is a heading</h1>
<h2>This is a heading</h2>
<h3>This is a heading</h3>
 
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
 
<a href="http://www.w3schools.com">This is a link</a>
 
<img src="http://www.w3schools.com/html/w3schools.jpg" alt="W3Schools.com" width="104" height="142">
</body>
</html>
index.php
<!DOCTYPE html>
<html>
<head>
  <link rel="stylesheet" href="styles.css">
</head>
<body>
 
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
 
</body>
</html>
styles.css
body {
    background-color: lightgrey;
}
 
h1 {
    color: blue;
}
 
p {
    color:green;
}

PHP

Open API

naver_movie.php
<!DOCTYPE html>
<html><head>
<meta charset="UTF-8">
</head>
<body>
<?php
 
$txt='';
$myfile = fopen("naver.out.txt", "w");
$lines = file('movie.dat');
$key = "9912dee981255d08ef6fb39c5f104069";
$year = "&yearfrom=2003&yearto=2004";
 
 
 
for ($i=0;$i<sizeof($lines);$i++) {
	$query=trim($lines[$i]);
	$url = "http://openapi.naver.com/search?key=".$key."&query=".$query."&target=movie";
	echo "<hr />";
	echo "Requested URL: " . $url ."\n\n<br />\n\n";
	$xml = simplexml_load_file($url);
 
// output raw starts
/*
	print "<pre>";
    print_r($xml->channel);
    print "</pre>";
    echo "<br /><br />";
*/
// output raw ends
 
foreach ($xml->channel->item as $movie) { // since exact query is not possible
      $title=strip_tags($movie->title);
      $subtitle=strip_tags($movie->subtitle);
 
      $year  = $movie->pubDate;
      $dire  = $movie->director;
      $dire = "\"".str_replace("|", "\" \"", $dire)."\"";
      $dire = str_replace("\"\"", "", $dire);
 
      $actor  = trim($movie->actor);
      $actor = "\"".str_replace("|", "\" \"", $actor)."\"";
      $actor = str_replace("\"\"", "", $actor);
      $nRating  = $movie->userRating;
 
      $txt = $title."\t".$subtitle."\t".$year."\t".$dire."\t".$actor."\t".$nRating."\n";
      $webtxt = "<br />*****<br />". $txt . "<br />*****<br />";
      echo $webtxt;
      fwrite($myfile, $txt);
      $txt='';
//    } else { }
  }
 
 
 
}
 
fclose($myfile);
 
?>
</body></html>
movie.dat
Interstellar
Citizen Kane
The Sixth Sense
Predestination

결과값: http://my-site/naver.php

c/nmp/web_development.1495411225.txt.gz · Last modified: 2017/05/22 08:30 by hkimscil

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki