Trying to use fsockopen to request a webpage

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
impulse()
Forum Regular
Posts: 748
Joined: Wed Aug 09, 2006 8:36 am
Location: Staffordshire, UK
Contact:

Trying to use fsockopen to request a webpage

Post by impulse() »

I'm trying to request a web page from an Apache server using fsockopen but I keep getting the error:

Broken pipe in /ste/a.php on line 7

This is the code:

Code: Select all

$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
$connection = socket_connect($socket, '<IP address of web server");
socket_write($socket, "GET /php/index.php");
echo "Written\n";
socket_close($socket);
Where am I going wrong?

Regards,
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

That doesn't look like fsockopen().
Post Reply