php download

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
CerIs
Forum Newbie
Posts: 22
Joined: Sat May 29, 2004 9:20 am

php download

Post by CerIs »

I have this script for calculating the google pagerank, it works but it gives you the result in the form of a download, eg you get asked to download pr.php in your browser which isnt what i want. I can do basic php but its using functions ive never heard of. I think the last couple of lines are producing the output

Code: Select all

<?php
$url = 'info:'.$_GET['url'];
$ch = GoogleCH(strord($url));
$url='info:'.urlencode($_GET['url']);
$curl = curl_init("http://www.google.com/search?client=navclient-auto&ch=6$ch&ie=UTF-8&oe=UTF-8&features=Rank&q=$url");
curl_setopt ($curl, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; GoogleToolbar 2.0.110-big; Windows 2000 5.0)");
curl_exec($curl);
?>
essentially i just want to know what var the final value is in. ( Can post whole script if required ) Thanks for the help.
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

Post by kettle_drum »

Try using sockets instead and then read the data you get and then print it to the screen.
redmonkey
Forum Regular
Posts: 836
Joined: Thu Dec 18, 2003 3:58 pm

Post by redmonkey »

Assign the result from curl_exec to a variable then grep out the required info from that.

cURL is generally a far easier option than using sockets.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

you may want to add:
curl_setopt wrote:CURLOPT_RETURNTRANSFER: Pass a non-zero value if you want CURL to directly return the transfer instead of printing it out directly.
Post Reply