Welcome Guest, Not a member yet? Register   Sign In
Cant post code!!!!???
#11

[eluser]CroNiX[/eluser]
See my edited post
#12

[eluser]behnampmdg3[/eluser]
Ok;

Good point. As you say, the constructor expects 2 params:
Code:
public function __construct($key, $secret)
  {
   $this->authHeader=array('Authorization: Basic '.base64_encode($key.':'.$secret));
  }


I changed to this below, but now I get blank page.

$param1 = 'skdjalsd';
$param2 = '87989';
$this->load->library('Mysms', $param1, $param2);
#13

[eluser]behnampmdg3[/eluser]
Blank page sucks. Any ideas?
#14

[eluser]behnampmdg3[/eluser]
oh wait!!!! It says:
Quote:A PHP Error was encountered

Severity: Warning

Message: Missing argument 1 for Mysms::__construct(), called in /hsphere/local/home/behnam/goldcoast-flatmates.com/system/core/Loader.php on line 1099 and defined

Filename: libraries/Mysms.php

Line Number: 13
A PHP Error was encountered

Severity: Warning

Message: Missing argument 2 for Mysms::__construct(), called in /hsphere/local/home/behnam/goldcoast-flatmates.com/system/core/Loader.php on line 1099 and defined

Filename: libraries/Mysms.php

Line Number: 13

But I AM passing them:
Code:
$param1 = ‘skdjalsd’;
$param2 = ‘87989’;
$this->load->library(‘Mysms’, $param1, $param2);
#15

[eluser]Tpojka[/eluser]
Usually, blank page is sign you are doing ok, but without output method.
Meaning: if there is no error message, it could be good.
I am asking you that duplicate your code here right in [ code][ /code]/*with no spaces after breckets*/ or edit your post above.
Also, try to hard code your library inserting your credentials into constructor parameters.

Edit, don't change your posts so often. Wink
#16

[eluser]behnampmdg3[/eluser]
[quote author="Tpojka" date="1391042151"]Usually, blank page is sign you are doing ok, but without output method.
Meaning: if there is no error message, it could be good.
I am asking you that duplicate your code here right in [ code][ /code]/*with no spaces after breckets*/ or edit your post above.
Also, try to hard code your library inserting your credentials into constructor parameters.[/quote]See 1 post above your post. ;p
#17

[eluser]CroNiX[/eluser]
With CI, I think you can only pass an array to the constructor, so you just need to adjust the constructor.

Something like:
Code:
public function __construct($config)
{
  $this->authHeader=array('Authorization: Basic '.base64_encode($config['key'].':'.$config['secret']));
}

Then instantiate like:
Code:
$config = array(
  'key' => 'xxxxx',
  'secret' => 'xxxx'
);
$this->load->library('mysms', $config);
$this->mysms->foo();

See the docs for the Loader class on the parameters you can pass to load::library();
#18

[eluser]behnampmdg3[/eluser]
PHP Syntax error

Parse error: parse error in /Users/pmdg3/Documents/test.com/application/libraries/Mysms.php on line 17
Code:
public function __construct($args)
  {
   $this->authHeader=array('Authorization: Basic '.base64_encode($args['key'].’:’.$args['secret']));
  
  }
#19

[eluser]CroNiX[/eluser]
Yeah, you have some curly quotes instead of single quotes in there. Sometimes the forum converts them. Don't blindly copy/paste without proof reading.
#20

[eluser]behnampmdg3[/eluser]
CroNix;

Thank you so much. All working.

We need to fix the CI forum. I had such a hard time you know?

Maybe you can help them.

Thanks again




Theme © iAndrew 2016 - Forum software by © MyBB