Comments (8)
Is the endpoint you are posting to expecting application/x-www-form-urlencoded? What error are you getting back? It looks like you are wrapping your array definition in a string there. The following works if I understand what you're trying to accomplish (the sendsForm
is not required by default but I have included it here to be safe).
$response = \Httpful\Request::post($destUrl)
->body(array(
'operation'=> 'login',
'username'=> $destUser,
'accessKey'=> $generatedKey))
->sendsForm()
->send();
from httpful.
Sorry about that. We moved to a versioned based phar naming scheme. You can download the latest version or choose from all versions on the downloads page
from httpful.
Mr Nat,
Thanks for the response.
Could you please kindly inform if I am making POST request wrongly as below:
$response1 = \Httpful\Request::post($destURL)
-> addHeaders(array('operation'=>'login', 'username'=>$destUser,
'accessKey'=>$generatedKey))
->send();
On Fri, Nov 2, 2012 at 8:39 PM, Nate Good [email protected] wrote:
Sorry about that. We moved to a versioned based phar naming scheme. You
can download the latest versionhttps://github.com/downloads/nategood/httpful/httpful-0.2.0.pharor choose from all versions on the downloads
page https://github.com/nategood/httpful/downloads—
Reply to this email directly or view it on GitHubhttps://github.com//issues/61#issuecomment-10016826.
Thanks and Regards,
Ravi Kishor Shakya
https://github.com/rkshakya/RKSProjects
http://ravikshakya.blogspot.com
"Start by doing what is necessary, then what is possible and suddenly you
are doing the impossible." -St Francis.
from httpful.
Did you intend to use headers or are you attempting to use that data in the
body? If it is the latter, change addHeaders
to body
. This also
assumes that you are using application form urlencoded as the mime type.
My guess is that is what you want.
On Fri, Nov 2, 2012 at 12:06 PM, Ravi Kishor Shakya <
[email protected]> wrote:
Mr Nat,
Thanks for the response.
Could you please kindly inform if I am making POST request wrongly as
below:
$response1 = \Httpful\Request::post($destURL)
-> addHeaders(array('operation'=>'login', 'username'=>$destUser,
'accessKey'=>$generatedKey))
->send();On Fri, Nov 2, 2012 at 8:39 PM, Nate Good [email protected]
wrote:Sorry about that. We moved to a versioned based phar naming scheme. You
can download the latest version<
https://github.com/downloads/nategood/httpful/httpful-0.2.0.phar>or
choose from all versions on the downloads
page https://github.com/nategood/httpful/downloads—
Reply to this email directly or view it on GitHub<
https://github.com/nategood/httpful/issues/61#issuecomment-10016826>.Thanks and Regards,
Ravi Kishor Shakya
https://github.com/rkshakya/RKSProjects
http://ravikshakya.blogspot.com"Start by doing what is necessary, then what is possible and suddenly you
are doing the impossible." -St Francis.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/61#issuecomment-10019336.
Nate Good
Director of Software Engineering
ShowClix, Inc.
Ph: 412.259.5869
Fax: 724.261.5332
http://www.showclix.com
from httpful.
Mr Nate,
I tried both (adding params in body / headers) but seems not working:
$response1 = \Httpful\Request::post($destURL)
->body("array('operation'=>'login', 'username'=>$destUser,
'accessKey'=>$generatedKey)", 'application/x-www-form-urlencoded')
->send();
Could not you please include a good example of POST request in the doc here
http://phphttpclient.com/#post-xml for benefit for many dumb people like me
? :)
Thanks
On Fri, Nov 2, 2012 at 10:07 PM, Nate Good [email protected] wrote:
Did you intend to use headers or are you attempting to use that data in
the
body? If it is the latter, changeaddHeaders
tobody
. This also
assumes that you are using application form urlencoded as the mime type.
My guess is that is what you want.On Fri, Nov 2, 2012 at 12:06 PM, Ravi Kishor Shakya <
[email protected]> wrote:Mr Nat,
Thanks for the response.
Could you please kindly inform if I am making POST request wrongly as
below:
$response1 = \Httpful\Request::post($destURL)
-> addHeaders(array('operation'=>'login', 'username'=>$destUser,
'accessKey'=>$generatedKey))
->send();On Fri, Nov 2, 2012 at 8:39 PM, Nate Good [email protected]
wrote:Sorry about that. We moved to a versioned based phar naming scheme.
You
can download the latest version<
https://github.com/downloads/nategood/httpful/httpful-0.2.0.phar>or
choose from all versions on the downloads
page https://github.com/nategood/httpful/downloads—
Reply to this email directly or view it on GitHub<
https://github.com/nategood/httpful/issues/61#issuecomment-10016826>.Thanks and Regards,
Ravi Kishor Shakya
https://github.com/rkshakya/RKSProjects
http://ravikshakya.blogspot.com"Start by doing what is necessary, then what is possible and suddenly
you
are doing the impossible." -St Francis.—
Reply to this email directly or view it on GitHub<
https://github.com/nategood/httpful/issues/61#issuecomment-10019336>.
Nate Good
Director of Software Engineering
ShowClix, Inc.Ph: 412.259.5869
Fax: 724.261.5332
http://www.showclix.com—
Reply to this email directly or view it on GitHubhttps://github.com//issues/61#issuecomment-10019882.
Thanks and Regards,
Ravi Kishor Shakya
https://github.com/rkshakya/RKSProjects
http://ravikshakya.blogspot.com
"Start by doing what is necessary, then what is possible and suddenly you
are doing the impossible." -St Francis.
from httpful.
This works! apparently sendForm is required
Thanks a lot.
On Fri, Nov 2, 2012 at 11:14 PM, Nate Good [email protected] wrote:
Is the endpoint you are posting to expecting
application/x-www-form-urlencoded? What error are you getting back? It
looks like you are wrapping your array definition in a string there. The
following works if I understand what you're trying to accomplish (the
sendsForm is not required by default but I have included it here to be
safe).$response = \Httpful\Request::post($destUrl)
->body(array('operation'=> 'login', 'username'=> $destUser, 'accessKey'=> $generatedKey)) ->sendsForm() ->send();
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/61#issuecomment-10022262.
Thanks and Regards,
Ravi Kishor Shakya
https://github.com/rkshakya/RKSProjects
http://ravikshakya.blogspot.com
"Start by doing what is necessary, then what is possible and suddenly you
are doing the impossible." -St Francis.
from httpful.
Mr Nate,
I was trying to make POST request as
$objectJson = json_encode($contactData);
$response = \Httpful\Request::post($destURL)
->body(array("sessionName"=>$sessionId,
"operation"=>'create',
"element"=>$objectJson,
"elementType"=>$moduleName))
->send();
and it fails. I tried these as well:
$objectJson = json_encode($contactData);
$response = \Httpful\Request::post($destURL)
->body(array("sessionName"=>$sessionId,
"operation"=>'create',
"element"=>$objectJson,
"elementType"=>$moduleName))
-> sendsForm()
->send();
and using smartSerializePayload() as $objectJson is complex object type
$objectJson = json_encode($contactData);
$response = \Httpful\Request::post($destURL)
->body(array("sessionName"=>$sessionId,
"operation"=>'create',
"element"=>$objectJson,
"elementType"=>$moduleName))
->smartSerializePayload( )
->send();
but it also did not work.
Could you please tell me what I am doing wrong?
I tried to go through the HTTPful API docs, but that was too technical.
Thanks
On Fri, Nov 2, 2012 at 11:20 PM, Ravi Kishor Shakya(रवि किशोर शाक्य) <
[email protected]> wrote:
This works! apparently sendForm is required
Thanks a lot.On Fri, Nov 2, 2012 at 11:14 PM, Nate Good [email protected]:
Is the endpoint you are posting to expecting
application/x-www-form-urlencoded? What error are you getting back? It
looks like you are wrapping your array definition in a string there. The
following works if I understand what you're trying to accomplish (the
sendsForm is not required by default but I have included it here to be
safe).$response = \Httpful\Request::post($destUrl)
->body(array('operation'=> 'login', 'username'=> $destUser, 'accessKey'=> $generatedKey)) ->sendsForm() ->send();
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/61#issuecomment-10022262.Thanks and Regards,
Ravi Kishor Shakya
https://github.com/rkshakya/RKSProjects
http://ravikshakya.blogspot.com"Start by doing what is necessary, then what is possible and suddenly you
are doing the impossible." -St Francis.
Thanks and Regards,
Ravi Kishor Shakya
https://github.com/rkshakya/RKSProjects
http://ravikshakya.blogspot.com
"Start by doing what is necessary, then what is possible and suddenly you
are doing the impossible." -St Francis.
from httpful.
Would be great to have this essential request on the "example"-page. I nearly searched more than an hour for an easy POST with PARAMS request unti I found this thread 👍
from httpful.
Related Issues (20)
- Composer autoload doesn't work HOT 2
- Test needs to be updated HOT 1
- Your website's domain has expired HOT 2
- Fortify Header Manipulation Vulnerability
- Body parsing broken in 0.3.0 HOT 2
- Timeouts HOT 1
- Curl proxy configuration is not used by Httpful HOT 1
- Got wrong json response HOT 1
- Download whole html web page including Css and js and images?
- Corrupted Response when JSON value is a XML
- Error 500 using PHP 7.3.29 (ok on 7.2.2) and largish payload
- curl required despite it not being mentioned in requirements and presented as an "alternative to curl"
- Oauth headers with post() HOT 1
- Warnings in PHP 8.1 HOT 5
- Trying to get in touch regarding a security issue HOT 2
- calling expectsJson() before body() of a post request breaks response parsing
- Documentation ????? HOT 2
- not work in php 5.3.1 HOT 1
- Support for PHP8+ HOT 4
- Templating broken by errant unset statement HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from httpful.