https://github.com/farhaanaliii/useragent
UserAgent is a PHP library that provides methods to generate random User-Agent strings for different platforms, including Windows, Linux, and mobile devices.
https://github.com/farhaanaliii/useragent
php scraping-useragents scraping-websites useragents web-scraping
Last synced: 26 days ago
JSON representation
UserAgent is a PHP library that provides methods to generate random User-Agent strings for different platforms, including Windows, Linux, and mobile devices.
- Host: GitHub
- URL: https://github.com/farhaanaliii/useragent
- Owner: farhaanaliii
- License: mit
- Created: 2024-04-14T14:38:51.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-18T10:39:31.000Z (7 months ago)
- Last Synced: 2025-03-31T10:01:32.564Z (2 months ago)
- Topics: php, scraping-useragents, scraping-websites, useragents, web-scraping
- Language: PHP
- Homepage:
- Size: 9.77 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# UserAgent
[](https://github.com/farhaanaliii/UserAgent/stargazers)
[](https://github.com/farhaanaliii/UserAgent/blob/main/LICENSE)
[](https://github.com/farhaanaliii/UserAgent/releases)UserAgent is a PHP library that provides methods to generate random User-Agent strings for different platforms, including Windows, Linux, and mobile devices.
## Installation
Download and include it in your project.
## Usage
Here's how you can use the UserAgent library in your PHP code:
```php
require_once 'src/UserAgent.php';// Generate a random User-Agent string for Windows
$userAgent = UserAgent::getWindows();
echo $userAgent;// Generate a random User-Agent string for Linux
$userAgent = UserAgent::getLinux();
echo $userAgent;// Generate a random User-Agent string for mobile devices
$userAgent = UserAgent::getMobile();
echo $userAgent;// Generate a random User-Agent string for any platform
$userAgent = UserAgent::getRandom();
echo $userAgent;
```
## Ouput```
Mozilla/5.0 (Windows NT 6.3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.6099.216 Safari/537.36
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.6261.130 Safari/537.36
Mozilla/5.0 (SAMSUNG; SAMSUNG-GT-S7609/7048HIXC5; U; Bada/1.2; en-us) AppleWebKit/533.1 (KHTML, like Gecko) Dolfin/63 Mobile WVGA SMM-MMS/1.2.0 OPN-B
Mozilla/5.0 (iPhone 5 X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/8.1.1 Mobile/iPhone14,7 Safari/604.1
```## Contributing
Contributions are welcome! If you find any issues or have suggestions for improvements, feel free to open an issue or create a pull request.
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.