Jump to content

[SOLVED] Yahoo search field


ryy705

Recommended Posts

Hello,

 

I am trying to write a script that will do automatic searches on yahoo.  But there is something funny in the action url of the form. 

http://images.search.yahoo.com/images;_ylt=A0geu8wEPwtJ4p0AEVql87UF?ei=UTF-8&fr2=tab-web&fr=

 

I didn't know that you could get away with putting a semi colon in the url.  In addition, what is the purpose of the _ylt field?  Does anyone know?

Link to comment
https://forums.phpfreaks.com/topic/130907-solved-yahoo-search-field/
Share on other sites

Not quite sure what you're wanting it to do, but the simplistic version of their form is this:

<form name="w" action="http://images.search.yahoo.com/search/images;_ylt=A0WTb_4aTgtJBzMAqwOLuLkF">
<input name="ei" value="utf-8" type="hidden">
<input name="fr" value="sfp" type="hidden">
<input name="p" id="yschsp" size="44" maxlength="100" value="">
<input class="ygbt" id="ygbtover" value="Image Search" type="submit">
<input name="iscqry" id="iscqry" type="hidden"></fieldset>
</form>

a simple solution (if I understand your question):


<?php
if ($_GET['page'] == "submit"){
$search_string = $_GET['search'];
echo<<<CHEESEBURGER
<html>
</head>
</head>
<body onload="document.w.submit();">
<form name="w" action="http://images.search.yahoo.com/search/images;_ylt=A0WTb_4aTgtJBzMAqwOLuLkF">
<input name="ei" value="utf-8" type="hidden">
<input name="fr" value="sfp" type="hidden">
<input name="p" id="yschsp" type="hidden" value="$search_string">
<input name="iscqry" id="iscqry" type="hidden"></fieldset>
</form>
</body>
</html>
CHEESEBURGER;
}
else{
$searches = array("test", "microsoft", "ubuntu", "cheeseburger");
foreach ($searches as $value){
	print "<a href='?page=submit&search=$value' target='_blank'>$value</a><br />\n";
}
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.