note 10692 added to CURL, Client URL Library Functions

From: Date: Wed, 17 Jan 2001 19:31:21 +0000
Subject: note 10692 added to CURL, Client URL Library Functions
Groups: php.notes 
Request: Send a blank email to php-notes+get-9898@lists.php.net to get a copy of this message
I used to download www pages to my script and one of the pages was different in MS explorer and different, when I downloaded it. Namely, information, I was really interested in was missing. That was because the server on the other bank of the river was looking at who is downloading the page. Everything got fixed when I pretended I was MSIE. It is done with curl. Here is a function, that you may use in similar situation function download_pretending($url,$user_agent) { $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_USERAGENT, $user_agent); curl_setopt ($ch, CURLOPT_HEADER, 0); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec ($ch); curl_close ($ch); return $result; } http://www.php.net/manual/en/ref.curl.php

« previous php.notes (#9898) next »