curl problem

Status
Not open for further replies.

nikec

New Member
Messages
2
Reaction score
0
Points
0
I created a curl script, but while running the script, I always get redirected to the x10hosting 404 page? Anyone has an idea why this is happening?

The script is for logging into a external forum, so not this one here + I have the intermediate account upgrade;

please help, I have no idea, thanks
 
Last edited:

Corey

I Break Things
Staff member
Messages
34,551
Reaction score
204
Points
63
If you're getting a 404 it's trying to go to a URL That doesn't exist.

Posting the code is probably your best bet to get any help.

-Corey
 

nikec

New Member
Messages
2
Reaction score
0
Points
0
this is my login function for the forum, but I'm getting a 404 not from the forum, but the one from x10hosting

Code:
	function login($username, $password)
	{
		global $_SERVER;
		$post_fields = $this->array_to_http(array(   // Generate post string
			'username'	=> $username,
			'password'	=> $password,
			'autologin'	=> 1,[
			'redirect'	=> 'index.php',
			'login'		=> 'Log In',
		));
		$this->curl = curl_init();
		curl_setopt ( $this->curl, CURLOPT_URL,  $this->phpbb_url . 'login.php' );
		curl_setopt ( $this->curl, CURLOPT_POST, true );
		curl_setopt ( $this->curl, CURLOPT_POSTFIELDS, $post_fields );
		curl_setopt ( $this->curl, CURLOPT_RETURNTRANSFER, true );
		curl_setopt ( $this->curl, CURLOPT_HEADER, false );
		curl_setopt ( $this->curl, CURLOPT_COOKIE, $this->cookie_name );
		curl_setopt ( $this->curl, CURLOPT_COOKIEJAR, $this->cookie_name );
		curl_setopt ( $this->curl, CURLOPT_COOKIEFILE, $this->cookie_name );
		curl_setopt ( $this->curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT'] );
		$result = curl_exec ( $this->curl );
		if ( curl_errno ( $this->curl ) )
		{
			$this->error = array(
				curl_errno($this->curl),
				curl_error($this->curl),
			);
			curl_close ( $this->curl );
			return false;
		}
		curl_close ( $this->curl );  // Close connection
		return true;  // Return result
	}
 

Corey

I Break Things
Staff member
Messages
34,551
Reaction score
204
Points
63
Please give a live link to where you are running into this problem at.
 
Status
Not open for further replies.
Top