Welcome Guest, Not a member yet? Register   Sign In
CI Proxy Library - Browser simulator (REST, Cookies and Proxy Support, PURE PHP) [NEW] HTTP Authorization
#21

[eluser]nermion[/eluser]
I love you, keep us updated Smile When you make it possible to click, submit I'll download and test and donate! Smile

btw just another idea, would it be possible to set fields perhaps something like
setField('fieldname', 'value');

asuming that there is a form somewhere on the site to be filled that accepts values, filling those values and then being able to click submit.

I found an example on the net:
$browser = &new; SimpleBrowser();
$browser->get('http://my-site.com/register.php');
$browser->setField('email', 'me@here');
$browser->setField('password', 'Secret');
$browser->click('Register');

so something like that, if lib can access a website and set fields and then click or submit, would rock and roll! Smile
#22

[eluser]toopay[/eluser]
[quote author="nermion" date="1304294952"]
btw just another idea, would it be possible to set fields perhaps something like
setField('fieldname', 'value');
[/quote]
It would be beyond that ;-)
#23

[eluser]nermion[/eluser]
well I'm looking forward to what you can do with this lib. It will be great add to codeigniter and I can't wait to start to play with it, dont give up on this project hehe!!! Smile
#24

[eluser]frozenmaiden[/eluser]
wow,it's cool if this lib can do that.. your suggestion is great,nermion. I will subscribe to this thread.
#25

[eluser]nermion[/eluser]
btw came to think of it, if this library does not support javascript then it will be limited to pure html only, if you have a button that is connected to javascript which submits the form, then this library will not be able to process that kind of page unless you have plans of adding some javascript engine implemented in php, well thats probably complicated anyways :=)
#26

[eluser]toopay[/eluser]
This library is intend to use on CLI too (in the future), thats why i didnt include what you called "javascript engine implemented in php". But create a class to bridge on it, should not hard to achieve ;-)
#27

[eluser]TomvB[/eluser]
I'm trying to use the geocode function to loop through a set of addresses and resolve the lat & lng from an address. It works on the first loop in my foreach, but on the second row it gives me this error:

php_network_getaddresses: getaddrinfo failed: Name or service not known [ERROR_CODE] = 0

Adding a wait(10) in my function does not work. The url on the second row looks OK and gives me json data if I open it using a browser.

Any idea's as to what is happening?
#28

[eluser]toopay[/eluser]
[quote author="TomvB" date="1306116728"]I'm trying to use the geocode function to loop through a set of addresses and resolve the lat & lng from an address. It works on the first loop in my foreach, but on the second row it gives me this error:

php_network_getaddresses: getaddrinfo failed: Name or service not known [ERROR_CODE] = 0

Adding a wait(10) in my function does not work. The url on the second row looks OK and gives me json data if I open it using a browser.

Any idea's as to what is happening?[/quote]

That error message usually generated while you try to access invalid url, but at this case, looping a geocode, the URL Schema builder in this lib seems failed. Well, i've just fix that. You can download the latest version and continue your nested loop ;-)
#29

[eluser]TomvB[/eluser]
[quote author="toopay" date="1306353347"][quote author="TomvB" date="1306116728"]I'm trying to use the geocode function to loop through a set of addresses and resolve the lat & lng from an address. It works on the first loop in my foreach, but on the second row it gives me this error:

php_network_getaddresses: getaddrinfo failed: Name or service not known [ERROR_CODE] = 0

Adding a wait(10) in my function does not work. The url on the second row looks OK and gives me json data if I open it using a browser.

Any idea's as to what is happening?[/quote]

That error message usually generated while you try to access invalid url, but at this case, looping a geocode, the URL Schema builder in this lib seems failed. Well, i've just fix that. You can download the latest version and continue your nested loop ;-)[/quote]

Nice, it's working now. Thanks a lot for the lib and the support!
#30

[eluser]toopay[/eluser]
Ssst! Updated to V 1.0.6

HTTP (GET, POST, PUT, DELETE), REST and HTTP Authentfication.

Code:
/* [USAGE] Basic http structure : */
/* $this->proxy->http($method, $destination_url, $request_parameter, $request_header_parameter); */
// $method is HTTP method : 'GET', 'POST', 'PUT', 'DELETE'
// $destination_url is the full url. Proxy lib will automaticly find the host, so include the full url, not only the domain
// $request_parameter is array of your GET, POST, PUT or DELETE parameter. eg : array('id' => 1);
// $request_header_parameter is array of custom HTTP header, it can be API key, oauth stuff, or any of your needs.
//     PS : For Basic HTTP Authorization, use : array('auth' => 'username:password'), as params

$this->load->library('proxy');
// An easy example performing basic 'POST' and get the result rendered.
echo $this->proxy->http('POST', 'http://somesite.com/login.php', array('username' => 'username', 'password' => 'password'));
// Perform an API Call? here you go...
// An example of GET
$username = 'taufanaditya';
$tweets = $this->proxy->http('GET', 'http://twitter.com/statuses/user_timeline/'.$username.'.json');
// Already have your own REST? Now you can perform a Rest Client Call, without cURL at all!
// An example of POST, with Basic HTTP Authentification
echo $this->proxy->http('POST', 'api.yourdomain.com/api/users', array('id' => 10, 'name' => 'Changed via Proxy'), array('auth' => 'username:password'));
// An example of PUT, with custom HTTP header (like API Key, or anything else)
$new_user = array(
    'name'             => 'John Doe',
    'username'         => 'johndoe',
    'email'            => '[email protected]',
    'password'         => 'secret',
    'confirm_password' => 'secret',
);
echo $this->proxy->http('PUT','api.yourdomain.com/api/users', $new_user, array('X-API-KEY' => 'fooandbarnotencrypted'));

ProxyLibrary_v1.0.6




Theme © iAndrew 2016 - Forum software by © MyBB