Forum Moderators: coopster

Message Too Old, No Replies

Overture Script

         

andyat11

8:10 pm on Mar 12, 2005 (gmt 0)

10+ Year Member



I am working on a script that works with overture.com

anyways It seems not to work heres my coding for whatever.php (where the coding is):

<?php
include ('mysql_connect.php');
$terms = "POST('terms')";
$terms = "http://inventory.overture.com/d/searchsuggestion/?term=<POST('terms'>";
$query = "INSERT INTO terms ($terms) VALUES ('$terms')";
$result = @mysql_query ($query);
echo "$terms";
?>

and It seems not to work PLZ help me THANK-YOU

ALSO I did set the mysql_connect.php page

[edited by: coopster at 8:32 pm (utc) on Mar. 12, 2005]
[edit reason] removed urls per TOS [webmasterworld.com] [/edit]

andyat11

11:16 pm on Mar 12, 2005 (gmt 0)

10+ Year Member



I need this figured out soon OH ya sry about the links

andyat11

12:25 am on Mar 13, 2005 (gmt 0)

10+ Year Member



this part and 1 above messages can be deleted

[edited by: andyat11 at 12:33 am (utc) on Mar. 13, 2005]

andyat11

12:32 am on Mar 13, 2005 (gmt 0)

10+ Year Member



Page 1 (Form a simple insert file)

<html>
<title></title>
<body>
<form action="whatever.php" ENCTYPE="multipart/form-data" method="post" name="terms">
<INPUT TYPE=file name=terms><input type="submit" name="submit" value="Submit" /></FORM>
&nbsp;<div align="center">&nbsp;</div>

</form><!-- End of Form -->
</body>
</html>

Page 2(php coding to send to database)

<?php
include ('mysql_connect.php');
$terms = "POST('terms')";
$terms = "http://inventory.overture.com/d/searchsuggestion/?term=<POST('terms'>";
$query = "INSERT INTO terms ($terms) VALUES ('$terms')";
$result = @mysql_query ($query);
echo "$terms";
?>

Page 3 (database display)

<?php

$page_title = 'View the Current Users';

require_once ('mysql_connect.php'); // Connect to the db.

// Make the query.
$query = "SELECT CONCAT(terms) AS dr FROM terms ORDER BY terms ASC";
$result = @mysql_query ($query); // Run the query.
if ($result) { // If it ran OK, display the records.

echo '<table align="center" cellspacing="2" cellpadding="2">
<tr><td align="left"><b>Name</b></td><td align="left"><b>NAME</b></td></tr>
';

// Fetch and print all the records.
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
echo "<tr><td align=\"left\">$row[0]</td><td align=\"left\">$row[1]</td></tr>\n";
}

echo '</table>';
mysql_free_result ($result); // Free up the resources.

} else { // If it did not run OK.
echo '<p>The users could not be displayed due to a system error. We apologize for any inconvenience.</p><p>' . mysql_error() . '</p>';
}

mysql_close(); // Close the database connection.

?>

andyat11

12:47 am on Mar 14, 2005 (gmt 0)

10+ Year Member



Ok got new coding for page 2 (but I get an error)
<?php
$terms = $_POST['terms'];
$url = "http://inventory.overture.com/d/searchsuggestion/?term= " + $terms ;
// In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead
// of $_FILES.

include ('mysql_connect.php');
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);

$filepointer = fopen($url,"r");
if($filepointer){
while(!feof($filepointer)){
$buffer = fgets($filepointer, 4096);
$file .= $buffer;
}
fclose($filepointer);
}
echo '<pre>';
if (move_uploaded_file($_FILES['userfile']['tmp_path'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Possible file upload attack!\n";
}

echo 'Here is some more debugging info:';
print_r($_FILES);

print "</pre>";

?>
IF anyone may know please help I'd appriciate it

coopster

12:35 pm on Mar 14, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, andyat11.

It may help if you explain what you are trying to accomplish and exactly what errors you are getting. Also, please review the PHP Forum Charter [webmasterworld.com] regarding Posting Guidelines.

Turbonutter

2:57 pm on Mar 14, 2005 (gmt 0)

10+ Year Member



I've reviewed your code and I don't think you're clear in what you're doing. Here is a simple version:

<?php
$terms = $_POST['terms'];
$url = "http://inventory.overture.com/d/searchsuggestion/?term=".urlencode($terms);
$page = file_get_contents($url); // PHP 4.3 and above

$page = mysql_escape_string($page);
mysql_query("insert into terms set terms='$page'");

?>

However, this will only store the page into your database. If you want to use the actual suggestions later on you'll need to parse them out with preg_match_all().

andyat11

3:19 pm on Mar 14, 2005 (gmt 0)

10+ Year Member



sorry for the delay but all coding sources will be found here
<removed>
it will show all coding

Im trying to take a file (.txt bounch of keywords) and take overture.com combine them and make all the ovt scrores used goto my database and when i mean keywords I mean 1 on each line

[edited by: jatar_k at 9:00 pm (utc) on Mar. 14, 2005]
[edit reason] no urls thanks [/edit]

andyat11

11:50 pm on Mar 15, 2005 (gmt 0)

10+ Year Member



sorry about the URLS again it is because Im triing to show an example

Turbonutter

1:14 pm on Mar 16, 2005 (gmt 0)

10+ Year Member



Look man, getting the pages is not your problem, parsing out the keywords and their scores is. I've done it, and parsing anything is never easy but overture was even more complicated. You're not going to be able to use any of the data you get unless you parse it.