|
[x]
Posted via EE Mobile
|
||
Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
||
| 01/18/2009 at 09:54AM PST, ID: 24062042 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: |
<?php
error_reporting(E_ALL);
//prevents script from timing out
set_time_limit(0);
//for POST request with curl
function do_post_request_curl($url, $data)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url); // set url to post to
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable
curl_setopt($ch, CURLOPT_POST, 1); // set POST method
curl_setopt($ch, CURLOPT_POSTFIELDS, $data); // add POST fields
$result = curl_exec($ch); // run the whole process
//echo $result;
curl_close($ch);
return $result;
}
function file_get_contents_curl($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Set curl to return the data instead of printing it to the browser.
curl_setopt($ch, CURLOPT_URL, $url);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
function getUrl ($sel_keyword) {
$arrLinks=array();
$cnt=0;
$url = 'http://www.google.com/search?hl=en&q='.urlencode($sel_keyword).'&btnG=Google+Search&aq=f&oq=';
$str = "'".file_get_contents($url)."'";
$h1count = preg_match_all('/\<li class=g\>\<h3 class=r\>\<a href="(.*?)" class=l\>/',$str,$patterns);
$href_add = $patterns[1];
if(!empty($href_add[0]))
{
foreach($href_add as $key => $val)
{
$val = preg_replace("/</","<a",$val);
//echo "<li>" . htmlentities($val) . "</li>";
$arrLinks[$cnt]=htmlentities($val);
++$cnt;
//number of urls code CJ
if($cnt==1)
{
break;
}
}
echo "</ul>";
}
return $arrLinks;
}
?>
<!--<?php include('includes/header.php');?>-->
<body>
<form id="form1" name="form1" method="get" action="">
KEYWORD:
<input name="keyword" type="text" id="keyword" value="<?php echo $_REQUEST['keyword']; ?>" />
URL :
<input name="url" type="text" size="30" id="url" value="<?php echo $_REQUEST['url']; ?>" />
<input type="submit" name="Submit" value="Submit" />
<br>
<br>
</form>
<?php
if ((isset($_REQUEST['Submit'])) && ($_REQUEST['url']!='')) {
?>
<fieldset>
<legend>Query result</legend>
<?php
$urlarray = array();
$urlarray[0]=$_REQUEST['url'];
$arrLinks=getUrl($_REQUEST['keyword']);
for($i=0,$j=1;$i<count($arrLinks);$i++,$j++){
$urlarray[$j]=$arrLinks[$i];
}
?>
<table border=1 width="80%">
<tr>
<th>Link</th>
<th>Item #1</th>
</tr>
<?php for($i=0;$i<count($urlarray);$i++){
// wait for 5 seconds = 5,000,000 HUMAN EMULATION
//usleep(5000000);
//Have a bit of a rest before we go check the next keyword 3-6 seconds
sleep(rand(2,3));
?>
<tr>
<td>
<?php
if($i==0){
?>
<a href="<?php echo $urlarray[$i];?>" style="color:blue"><?php echo $urlarray[$i];?></a>
<?php
}
else{
?>
<a href="<?php echo $urlarray[$i];?>"><?php echo $urlarray[$i];?></a>
<?php
}
?> </td>
<?php
ob_start();
//put your site's URL here, but leave off the http://www
//$url = "windmillaeration.com";
//put all the keywords you want to check here, make sure you leave the single quotes and commas intact for each keyword
//$keywords = array(
//'"pond aeration"',
//'windmill aeration',
//'windmill',
// );
//Just tells us what URL we're checking rankings for
//echo "<h2> Google SERPS For " .$url. "</h2>";
//start to run through each of the keywords
//foreach($keywords as $keyword) {
//set our counter at zero, so we can work out what the ranking of the page
//$count = 0;
//make a URL that we can query Google with
$search = "http://www.google.com/search?q=".$urlarray[$i]."&num=100";
//now go get that page
$google = file_get_contents($search);
//funky regular expression stuff to find our URL in the results
$description= ('/<h3 class=r><a href=\"(.+?)\" class=l/');
preg_match_all($description,$google,$match);
//start looping through each of the results on the page
foreach( $match[1] as $value){
$count = $count + 1;
//check each of the 100 results from google, to see if our URL is in it.
if(strstr($value,$urlarray[$i])) {
//if this particular result has our URL in it, print it to the page, along with the ranking ($count variable from above)
//echo $keyword. " - " .$count. "<br>";
ob_flush();
flush();
}
}
//Have a bit of a rest before we go check the next keyword, so we don't get booted from the Goog'
sleep(rand(30,60));
}
?>
<td><?php echo $keyword. " - " .$count;?></td>
</tr>
<?php } ?>
</table>
</fieldset>
</body>
<!--<?php include('includes/footer.php'); ?>-->
</html>
|
Advertisement