<?php $url = "http://boards.gamefaqs.com/gfaqs/search.php?board=2000111&search=hjt"; $ch = curl_init(); $timeout = 2; // set to zero for no timeout curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $content = @curl_exec($ch); $info = curl_getinfo($ch); curl_close($ch); if($info['http_code'] == '200') { $topic = preg_match_all('`http://boards.gamefaqs.com/gfaqs/genmessage.php?board=2000111&topic=(.*)\n?"?`',$content,$matches); print_r($matches[1]); } ?>
PHP Search
Started by
Tigger93
, Apr 22 2007 07:44 PM
#16
Posted 24 April 2007 - 08:23 PM
#17
Posted 24 April 2007 - 08:28 PM
When I looked at the source code, http://boards.gamefa...g...0111&topic= could not be found !
But maybe this would help
/gfaqs/genmessage.php?board=2000111&topic=
But maybe this would help
/gfaqs/genmessage.php?board=2000111&topic=
#18
Posted 24 April 2007 - 08:31 PM
Ah, didn't see that. Just tried it though, same thing...
<?php $url = "http://boards.gamefaqs.com/gfaqs/search.php?board=2000111&search=hjt"; $ch = curl_init(); $timeout = 2; // set to zero for no timeout curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $content = @curl_exec($ch); $info = curl_getinfo($ch); curl_close($ch); if($info['http_code'] == '200') { $topic = preg_match_all('`http://boards.gamefaqs.com/gfaqs/genmessage.php?board=2000111&topic=(.*)\n?"?`',$content,$matches); print_r($matches[1]); } ?>
#19
Posted 24 April 2007 - 08:37 PM
<?php $url = "http://boards.gamefaqs.com/gfaqs/search.php?board=2000111&search=hjt"; $ch = curl_init(); $timeout = 2; // set to zero for no timeout curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $content = @curl_exec($ch); $info = curl_getinfo($ch); curl_close($ch); if($info['http_code'] == '200') { $topic = preg_match_all('`/gfaqs/genmessage.php\?board=2000111&topic=([0-9]*)`',$content,$matches); print_r($matches[1]); } ?>
??
And I changed to [0-9] since I know know that value can only be numbers.
Edited by Michael, 24 April 2007 - 08:38 PM.
#20
Posted 24 April 2007 - 08:42 PM
Yay! Works now. Many thanks for all your help.
Is there anyway though it could make those links and take you to it (to the topic)?
Is there anyway though it could make those links and take you to it (to the topic)?
#21
Posted 24 April 2007 - 08:46 PM
<?php $url = "http://boards.gamefaqs.com/gfaqs/search.php?board=2000111&search=hjt"; $ch = curl_init(); $timeout = 2; // set to zero for no timeout curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $content = @curl_exec($ch); $info = curl_getinfo($ch); curl_close($ch); if($info['http_code'] == '200') { $topic = preg_match_all('`/gfaqs/genmessage.php\?board=2000111&topic=([0-9]*)`',$content,$matches); foreach($matches[0] as $key => $value){ $label = $matches[1][$key]; echo("<a href=\"http://boards.gamefaqs.com$value\">$label</a>"); } } ?>
EDIT: You may want to make that look nicer.
Edited by Michael, 24 April 2007 - 08:47 PM.
#22
Posted 24 April 2007 - 08:49 PM
Thanks for all the help!! I really appreciate it. One last question, anyway to add a space between each link, or put one per line? Sorry for all the requests.
#23
Posted 24 April 2007 - 08:52 PM
foreach($matches[0] as $key => $value){
$label = $matches[1][$key];
echo("<div><a href=\"http://boards.gamefaqs.com$value\">$label</a></div>");
}
#24
Posted 24 April 2007 - 08:54 PM
Woot! Thanks so much.
Similar Topics
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users