Page 1 of 1

Resource id's

Posted: Thu Jun 10, 2010 1:14 pm
by niallsc
Hello,
I will preface this question by saying that yes, I am a newb.... moving on though,
I am trying to open a google search webpage and get the source code, pretty simple i thought...
anyways every time I try it i get this weird "Resource id #6" or "Resource id #5"... Anyone know what might be causing this?
here is my source, any Help would be greatly appreciated!

Code: Select all

  $url="http://www.google.com/search?sourceid=chrome&ie=UTF-8&q=";
	
  #$url= "http://search.yahoo.com/search;_ylt=Avxb5GJ0gxf5XZ4J4uOAM9CbvZx4?p=";
  $myWord1="used"; 
  $myWord2="cars";
  $newSearch=$url.$myWord1."+".$myWord2;
  
  #$searchSource=fopen("http://www.google.com/search?hl=en&q=used+cars&aq=f&aqi=g10&aql=&oq=&gs_rfai=", "r");	
  $searchSource= fopen($newSearch, "r");
  #$insideUrl= fgets($searchSource);
  
  
  #echo "<br>Url=";
  echo $newSearch;
  
  echo "\n";
  echo "$searchSource \n";


Thanks in advance :)

Re: Resource id's

Posted: Thu Jun 10, 2010 1:31 pm
by AbraCadaver
Look up fopen() in the manual, it returns a file pointer resource. I would use file_get_contents().

Re: Resource id's

Posted: Thu Jun 10, 2010 1:46 pm
by niallsc
You are amazing! file_get_contents did exactly what i needed! Thank you so much!