Here I have a two files. One for forms and second php for getting results...
PHP file:
$site=$_GET['textfield1']
$xpathfromform=$_GET['textfield2']
$dom = new DOMDocument();
@$dom->loadHTMLFile($site);
$xpath = new DOMXPath($dom);
$result = $xpath->query($xpathfromform)->item(0)->textContent;
second file is a form:
<!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=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<label>Enter URL address here:
<input name="textfield" type="text" value="http://www." />
</label>
<label>
<input type="submit" name="Submit" value="Submit" />
<br />
<br />
Enter xpath location of element:
<input type="text" name="textfield2" />
<input type="submit" name="Submit2" value="Submit" />
<br />
<br />
Selected element is: </label>
<p> </p>
</body>
</html>
How to connect this two files with JSON... example what I need:
1st. type URL and then xpath and click on submit 2nd. when I click I need to start .php file to get result 3th. I must get $result from php file and show in my first file ...
How to connect this two files with json ??? or something else.