Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set proxy IP #180

Open
zhqingphp opened this issue May 24, 2023 · 3 comments
Open

How to set proxy IP #180

zhqingphp opened this issue May 24, 2023 · 3 comments

Comments

@zhqingphp
Copy link

How to join the agent using an agent IP

[ 'request_fulluri' => true, 'proxy' => 'ip:port', 'header' => [ 'Proxy-Switch-Ip' => 'yes', 'Proxy-Authorization' => 'Basic ' . base64_encode('user:pass') ], ] ];
@zhqingphp
Copy link
Author

zhqingphp commented May 24, 2023

<?php $header = array( 'http' => array( 'proxy' => 'ip:port', 'request_fulluri' => true, 'header' => "Proxy-Authorization: Basic " . base64_encode('user:pass'), ), ); $client = new \WebSocket\Client("ws://127.0.0.1:2566/", $header); $client->text("Hello WebSocket.org!"); echo $client->receive(); $client->close();

@zhqingphp
Copy link
Author

The above code is invalid, how to set it?

@sirn-se
Copy link
Contributor

sirn-se commented May 31, 2023

Hi @zhqingphp,

based on your code example, I suspect that it is the context option you're looking for, not header.

  • Create a stream context as described here
  • Add it as option when creating the Client, as described here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants