kriona wrote in php

Scripts and User Agents

Say you have two sites, site 1 and site A. Site 1 records all traffic and user agents. Site A uses some sort of function, like file_get_contents(), to get some information from Site 1. However, it sends an empty user agent. How can you get Site A to send a user agent to Site 1 whenever it tries getting something?

I don't really have a use for this, I'm just curious how it's done.


Figures! I look for 45 mins, find nothing, post, and then within 10 minutes I've found the answer.
ini_set('user_agent', 'your agent');
$url = 'http://www.example.com';
$fp = fopen($url, "r");

while (!feof($fp)) {

	$buffer = fread($fp, 1024);

}