This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
u'customer': None, | |
u'amount_refunded': 0, | |
u'fee': 259, | |
u'disputed': False, | |
u'description': u'CanvasOnDemand: VFS\u2013COD1022\u20131026$52Canvas(UNIQUECODES): OrderID=508569a7375e886cbd000041: OfferRef=canvasondemand_email', | |
u'created': 1350920815, | |
u'refunded': False, | |
u'livemode': True, | |
u'failure_message': None, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
u'account_balance': 0, | |
u'description': u'104627-johnnymarmolejo', | |
u'created': 1351305591, | |
u'livemode': True, | |
u'object': u'customer', | |
u'email': u'mstaniaraquel@aol.com', | |
u'active_card': { | |
u'address_city': None, | |
u'exp_month': 8, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$url = 'http://localhost/tests/test_get'; # URL to the service | |
$data = array( | |
'first_name' => 'siddharth', | |
'last_name' => 'saha', | |
'city' => 'pune' | |
); | |
# Making the URL with the parameters to be sent with the request |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$url = 'http://localhost/tests/test_post'; # URL for the POST request | |
$request = curl_init($url); | |
$post_options = array( | |
CURLOPT_POST => 1, # signifies it is a POST request | |
CURLOPT_POSTFIELDS => $data, # $data is the data that you want to POST | |
CURLOPT_RETURNTRANSFER => true # required if you want to capture the response data as a string instead of just printing to the console | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$url = 'http://localhost/tests/upload_file'; #URL for the service | |
$file_path = '/home/siddharthsaha/Desktop/production.html'; # File to be uploaded | |
$data = array( | |
'owner' => 'siddharth saha', | |
'test_file' => '@' . $file_path # For files, you have to append a @ before the filepath. | |
); | |
# Make the curl request exactly as in the POST example above. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$request = new HttpRequest($url, HttpRequest::METH_GET); #METH_GET indicates that it is a GET request | |
$request->addQueryData($data); # $data is the array with the parameters to send | |
$request->send(); | |
if ($request->getResponseCode() == 200) { | |
$response = json_decode($request->getResponseBody()); | |
# we have the response from the web-service | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$request = new HttpRequest($url, HttpRequest::METH_GET); #METH_GET indicates that it is a GET request | |
$request->addQueryData($data); # $data is the array with the parameters to send | |
$request->send(); | |
if ($request->getResponseCode() == 200) { | |
$response = json_decode($request->getResponseBody()); | |
# we have the response from the web-service | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$request = new HttpRequest($url, HttpRequest::METH_GET); # METH_GET signifies it is a GET request | |
$request->addQueryData($data); # $data is the array with the parameters to send | |
$request->send(); | |
if ($request->getResponseCode() == 200) { | |
$response = json_decode($request->getResponseBody()); | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$request = new HttpRequest($url, HttpRequest::METH_GET); # METH_GET signifies it is a GET request | |
$request->addQueryData($data); # $data is the array with the parameters to send | |
$request->send(); | |
if ($request->getResponseCode() == 200) { | |
$response = json_decode($request->getResponseBody()); | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$request = new HttpRequest($url, HttpRequest::METH_POST); # METH_POST indicates a POST request | |
$request->addPostFields($data); # use this method to add data to the POST request | |
$request->send(); | |
if ($request->getResponseCode() == 200) { | |
$response = json_decode($request->getResponseBody()); | |
} | |
?> |
OlderNewer