Jump to content

Recommended Posts

Heres the situation. There are 2 web pages. Web page A is where I login. Web page B is where I need to go after logging in.

 

I managed to get logged in, but I have no clue on how to get to Web page B. Please Help?

 

Code Snippet:

$url = 'http://www.website.com/webpageB.php';
$http = new HttpRequest( 'http://www.website.com/webpageA.php', HTTP_METH_POST );
$http->addPostFields( array( 'login_username' => 'username', 'login_password' => 'pass', 'remember' => '1'  ) );
$http->send();
$cookies = $http->getResponseCookies();
foreach( $cookies as $cookie ) {
$http->addCookies( $cookie->cookies );
}
$http->setUrl($url);
$http->send();
echo $http->getResponseBody();

 

I need to get to Web page B to parse some text and retrieve it back, but it never reaches Web page B. What in the world am I doing wrong?

 

Please help!

Link to comment
https://forums.phpfreaks.com/topic/171099-help-with-httprequest/
Share on other sites

ermmm......

 

 

all I would say is check your login credentials and then use

 

header('Location: http://www.website.com/webpageB.php');

 

The login credentials are correct. Im not trying to load the page in my 'browser'. Im trying to login, and change the page while the php serverside code is going through in order to parse some data back and echo it to 'my' page.

 

I hope you understand what I mean.

You're using some XML HTTP Request object library in PHP? I'd start and use javascript, since user login -> user page can be direct

 

login.php -> checklogin.php

checklogin.php -> user.php

 

Your PHP method doesn't look like it could without header()...

http://us3.php.net/manual/en/class.httprequest.php

 

Is that XML HTTP Request or am I missing something? Whats it doing in php.net?

 

I am not trying to redirect ANYONE anywhere. I am simply trying to keep the user in MY page. When they click on a button, I want php to 'serverside' login, go to a certain page, retrieve specific text, stick it to a variable, and ECHO back on MY page. I dont even want the user to know the page exists outside of my hosting.

 

Them being redirected there has nothing to do with. Now I hope you understand what i mean.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.