PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPHP Development
The ASP Free website provides in-depth information on the latest developer tools available from Microsoft. Our cadre of writers, highly experienced industry experts, reveals the best ways to use established technologies as well as new and emerging technologies. Our coverage of Microsoft's development and administration technologies is among the most respected in the IT industry today.

ASP Free and Iron Speed Designer are giving away $5,500+ in FREE licenses. Iron Speed's RAD CASE toolset can save up to 80% of your coding time. One free license per week, one perpetual license per month!
Download and Activate to enter!

Intel® Graphics Performance Analyzers is a powerful tool suite for analyzing and optimizing your games, media, and graphics-intensive applications. Used by some of the best developers on the planet, Intel GPA lets you maximize your app’s performance.


Tutorials
| Forums

Download to Enter
| Contest Rules

DOWNLOAD INTEL® GPA FOR FREE

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 2nd, 2002, 12:05 AM
kishysss kishysss is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2002
Location: India
Posts: 0 kishysss User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Arrow fopen mess please help

Hope i get a solution for this problem

this script runs fine when i run it for MSN or Alltheweb.

GOOGLE..........?

Warning: fopen("http://www.google.com/search?hl=en&q=link:URL","r") - Transport endpoint is not connected in /home/clients/pressnote.net/www/test/php_in.php on line 22
Could not connect to remote server [URL[/url]]


The code i am using is :

<?
function get_linkpop($domain,$engine)
{

if($engine == "1")
{
$url = "http://www.alltheweb.com/search?cat=web&lang=any&query=link.all:[DOMAIN]";
}
elseif($engine == "2")
{
$url = "http://www.google.com/search?hl=en&q=link:[DOMAIN]";
}
elseif($engine == "3")
{
$url = "http://search.msn.com/results.asp?RS=CHECKED&FORM=MSNH&v=1&q=linkdomain:[DOMAIN]";
}

$domain = rawurlencode(trim($domain));
$url = eregi_replace("\[DOMAIN\]",$domain,$url);

$fp = fopen("$url", "r");
if(!$fp) {
die("Could not connect to remote server [$url]");
}

$html = "";
while (!feof($fp))
{
$html .= fread($fp, 1000);
}
fclose($fp);



if($engine == "1")
{
$lines = split("[\n]","$html");

foreach ($lines as $line)
{
if(eregi("Displaying results",$line))
{
$line = eregi_replace("Displaying results 1-10 of ","",$line);
$line = eregi_replace(" pages found.{1,5}","",$line);
break;
}
}
}
elseif($engine == "2")
{
$lines = split("[\n]","$html");

foreach ($lines as $line)
{
if(eregi("of about ",$line))
{
$line = eregi(" about .{1,10}.",$line,$reg);
$line = str_replace(",","",$reg[0]);
$line = eregi("[0-9]{1,10}",$line,$reg);
$line = $reg[0];
break;
}
}
}
elseif($engine == "3")
{
$lines = split("[\n]","$html");

foreach ($lines as $line)
{

if(eregi("Results.{1,90}containing",$line))
{
$line = eregi("about [0-9]{0,30} containing",$line,$reg);
$line = eregi_replace("(about )","",$reg[0]);
$line = eregi_replace("( containing)","",$line);
break;
}

}
}

$line = str_replace(",","",$line);
$line = trim($line);
if($line == "" || ereg("[a-zA-Z]",$line)) {$line = "0";}
return $line;

}

get_linkpop("www.indiapress.org",2);

echo $line;

?>



Can't get what went wrong in there.....for GOOGLE

Please help

Reply With Quote
  #2  
Old February 2nd, 2002, 05:57 PM
rajensama rajensama is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2001
Location: Germany
Posts: 27 rajensama User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 4 m 14 sec
Reputation Power: 0
You can not read google using fopen because google checks from where the request is coming and may be the url you gave is correct but it does not work. If you really need the google result try with google.yahoo.com in stead of google.com
suppose u want to find query then
http://google.yahoo.com/bin/query?p=query&hc=0&hs=0
Then you get the result from yahoo but these result are returned by google.
i hope it helps you
__________________
rajensama

Reply With Quote
  #3  
Old February 2nd, 2002, 06:03 PM
rajensama rajensama is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2001
Location: Germany
Posts: 27 rajensama User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 4 m 14 sec
Reputation Power: 0
You can not read google using fopen because google checks from where the request is coming and may be the url you gave is correct but it does not work. If you really need the google result try with google.yahoo.com in stead of google.com
suppose u want to find query then
http://google.yahoo.com/bin/query?p=query&hc=0&hs=0
Then you get the result from yahoo but these result are returned by google.
i hope it helps you

Reply With Quote
  #4  
Old August 5th, 2003, 08:24 AM
rajan.kumar rajan.kumar is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: India
Posts: 0 rajan.kumar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question I have a true Solution for you

Hello kishysss,

I just have gone with your problem, and would like to suggest that few replies are misguiding you. You can definitly be correct with your code and i'm 100% sure that you can open google.com with your "fopen()" in PHP.

Problem might be with PHP side just review once again your php.ini and try to find "allow_url_fopen " and be sure to enable it.

Try to check using "phpinfo()" function with code,
use the following code:

<?php
phpinfo();
?>
save as file and review the PHP related Informations.

I'll be glad if I can be helpful to come u over this problem

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Check link popularity problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.

© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 3 - Follow our Sitemap