I need to use ajax to make this whole process smoother.
Here is a demo: http://www.theflickzone.com/dev/
If anyone can do this for me I will pay a few $ via paypal to say thanks :)
Contents of index.html
<form action="return.php" method="POST"> <p>IMDB URL: <input type="text" name="imdb" autocomplete="off"></p> <p>Links(line by line): <textarea cols="50" rows="5" name="links" autocomplete="off"></textarea></p> <p><input type="submit" /></p> </form>Contents of return.php
<?php function get_inner_string($a,$b,$c) { $y = explode($b,$a); $x = explode($c,$y[1]); return $x[0]; } $imdb = $_POST['imdb']; $openIMDB = file_get_contents($imdb); $findTitle = get_inner_string($openIMDB, '<b>', '</b>'); $posterUrl = $_POST['imdb']; $posterUrl = preg_replace( '~http://www.imdb.com/title/tt\d+/~', 'http://www.theflickzone.com/IMDBPoster/getPoster.php?url=$0', $posterUrl ); $posterUrl = preg_replace( '~url=http://www.imdb.com~', 'url=', $posterUrl ); echo '[IMG]' . $posterUrl . '[/IMG]'; echo ''; echo ''; echo '[IMDB]'.$imdb.'[/IMDB]'; echo ''; $findPlot = get_inner_string($openIMDB, '<h5>Plot:</h5>', '<a class'); echo ''; echo ''; $links = explode("\n", $_POST['links']); $count = count($links); if ($count == '1'){ $linksN = implode(\n, $links); echo '<p>[FULL]' . $linksN . '[/FULL]</p>'; } else { for($i=0;$i<$count;$i++) { echo '[PART="'.($i+1).'"]'.$links[$i].'[/PART] '; } } ?>
Hi !Unreal,
you may use this code for needed functionality, you will only need to change in index.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript">
function getHTTPObject() {
var http = false;
//Use IE's ActiveX items to load the file.
if(typeof ActiveXObject != 'undefined') {
try {http = new ActiveXObject("Msxml2.XMLHTTP");}
catch (e) {
try {http = new ActiveXObject("Microsoft.XMLHTTP");}
catch (E) {http = false;}
}
//If ActiveX is not available, use the XMLHttpRequest of Firefox/Mozilla etc. to load the document.
} else if (XMLHttpRequest) {
try {http = new XMLHttpRequest();}
catch (e) {http = false;}
}
return http;
}
var http = getHTTPObject();
var url = "return.php";
function handler() {//Call a function when the state changes.
if(http.readyState == 4 && http.status == 200) {
document.getElementById('txt').innerHTML = http.responseText;
}
}
function postMethod(a,b) {
var params = "imdb=" + a + "&links=" + b;
http.open("POST", url, true);
//Send the proper header infomation along with the request
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.setRequestHeader("Content-length", params.length);
http.setRequestHeader("Connection", "close");
http.onreadystatechange = handler;
http.send(params);
}
</script>
</head>
<body>
<form action="return.php" method="POST" name="frm">
<p>IMDB URL:
<input type="text" name="imdb" autocomplete="off">
</p>
<p>Links(line by line):
<textarea cols="50" rows="5" name="links" autocomplete="off"></textarea>
</p>
<p>
<input name="Submit" type="button" onclick="postMethod(document.frm.imdb.value, document.frm.links.value)" value="Submit" />
</p>
</form>
<div id="txt"></div>
</body>
</html>
I hope this code will help you, feel free to PM me ;)
Rahul Dev Katarey