strago Posted August 7, 2010 Share Posted August 7, 2010 I try changing POST to GET in the script and I just get a blank page. How do you use a URL like... http-//www.domain.com/whois.php?domains=http://www.URL.info|Page Title to run the script? <? set_time_limit(0); if($_POST) { $domains = explode("\n", $_POST[domains]); foreach($domains as $domain) { $domain = explode('|', $domain); $keyword = $domain[1]; $domain = str_replace(array('http://','/'),'',$domain[0]); echo $keyword . $domain; unset($urls); $domainshort = str_replace('www.','',$domain); $domainshortdash = str_replace('.','-',$domainshort); $urls[] = 'http://www.webtrafficagents.com/Whois/' . $domain; $urls[] = 'http://whois.domaintools.com/' . $domainshort; $ch = curl_init(); foreach($urls as $url) { curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"); curl_setopt ($ch, CURLOPT_TIMEOUT, 60); curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_REFERER, 'http://www.google.com/'); $AskApache_result = curl_exec ($ch); $regex = '/<title>(.+?)<\/title>/'; preg_match($regex,$AskApache_result,$output); echo $output[1] . '<br>'; flush(); ob_flush(); curl_setopt ($ch, CURLOPT_URL, 'http://pingomatic.com/ping/?title=' . urlencode($keyword) . '&blogurl=' . urlencode($url) . '&rssurl=http%3A%2F%2F&chk_weblogscom=on&chk_blogs=on&chk_technorati=on&chk_feedburner=on&chk_syndic8=on&chk_newsgator=on&chk_myyahoo=on&chk_pubsubcom=on&chk_blogdigger=on&chk_blogrolling=on&chk_blogstreet=on&chk_moreover=on&chk_weblogalot=on&chk_icerocket=on&chk_newsisfree=on&chk_topicexchange=on&chk_google=on&chk_tailrank=on&chk_bloglines=on&chk_postrank=on&chk_skygrid=on&chk_bitacoras=on&chk_collecta=on'); $AskApache_result = curl_exec ($ch); if(preg_match('/Pinging complete!/', $AskApache_result)) { echo $url . ' - Successful Backlink!<br>'; } else { echo $url . ' - <b>Backlink Failed!</b><br>'; } flush(); ob_flush(); } } } else { ?> <form method="post"> Links|Anchors :<br> <textarea name="domains" cols=50 rows=5></textarea><br> <br> <input type="submit"> </table> </form> <? } ?> Link to comment https://forums.phpfreaks.com/topic/210073-run-php-script-from-url-instead-of-form/ Share on other sites More sharing options...
Eiolon Posted August 7, 2010 Share Posted August 7, 2010 Did you try to put the URL in the <form> tag? <form action="URL" method="post"> Link to comment https://forums.phpfreaks.com/topic/210073-run-php-script-from-url-instead-of-form/#findComment-1096405 Share on other sites More sharing options...
strago Posted August 7, 2010 Author Share Posted August 7, 2010 Using a form is what I'm trying NOT to do. Instead of using a form, running the script directly from a URL, using no form at all. http-//www.domain.com/whois.php?domains=http://www.URL.info|Page Title From the form it works just fine. Link to comment https://forums.phpfreaks.com/topic/210073-run-php-script-from-url-instead-of-form/#findComment-1096412 Share on other sites More sharing options...
PradeepKr Posted August 8, 2010 Share Posted August 8, 2010 This works for me <?php set_time_limit(0); if(isset($_REQUEST['domains'])) { echo "Check Started "; $domains = explode("\n", $_REQUEST['domains']); foreach($domains as $domain) { $domain = explode('|', $domain); $keyword = $domain[1]; $domain = str_replace(array('http://','/'),'',$domain[0]); echo $keyword . $domain; unset($urls); $domainshort = str_replace('www.','',$domain); $domainshortdash = str_replace('.','-',$domainshort); $urls[] = 'http://www.webtrafficagents.com/Whois/' . $domain; $urls[] = 'http://whois.domaintools.com/' . $domainshort; $ch = curl_init(); foreach($urls as $url) { curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"); curl_setopt ($ch, CURLOPT_TIMEOUT, 60); curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_REFERER, 'http://www.google.com/'); $AskApache_result = curl_exec ($ch); $regex = '/<title>(.+?)<\/title>/'; preg_match($regex,$AskApache_result,$output); echo $output[1] . '<br>'; flush(); ob_flush(); curl_setopt ($ch, CURLOPT_URL, 'http://pingomatic.com/ping/?title=' . urlencode($keyword) . '&blogurl=' . urlencode($url) . '&rssurl=http%3A%2F%2F&chk_weblogscom=on&chk_blogs=on&chk_technorati=on&chk_feedburner=on&chk_syndic8=on&chk_newsgator=on&chk_myyahoo=on&chk_pubsubcom=on&chk_blogdigger=on&chk_blogrolling=on&chk_blogstreet=on&chk_moreover=on&chk_weblogalot=on&chk_icerocket=on&chk_newsisfree=on&chk_topicexchange=on&chk_google=on&chk_tailrank=on&chk_bloglines=on&chk_postrank=on&chk_skygrid=on&chk_bitacoras=on&chk_collecta=on'); $AskApache_result = curl_exec ($ch); if(preg_match('/Pinging complete!/', $AskApache_result)) { echo $url . ' - Successful Backlink!<br>'; } else { echo $url . ' - <b>Backlink Failed!</b><br>'; } flush(); ob_flush(); } } } else { ?> <form method="post"> Links|Anchors :<br> <textarea name="domains" cols=50 rows=5></textarea><br> <br> <input type="submit"> </table> </form> <?php } ?> Link to comment https://forums.phpfreaks.com/topic/210073-run-php-script-from-url-instead-of-form/#findComment-1096470 Share on other sites More sharing options...
strago Posted August 8, 2010 Author Share Posted August 8, 2010 Thanks. That's exactly what I was trying to get. Link to comment https://forums.phpfreaks.com/topic/210073-run-php-script-from-url-instead-of-form/#findComment-1096519 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.