» How to parse cURL postdata with PHP?
How to parse cURL postdata with PHP?
|September 9, 2014
Posted by forumadmin
Is there any way to parse posts by
I have a PHP client what use this cURL call:
data1 = array(
"email" => $email,
"firstname" => $firstname,
"lastname" => $lastname,
"code" => $code
$data_string = json_encode($data1);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, $user.":".$passwd);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Length: ' . strlen($data_string))
$response = curl_exec($ch);
How can I parse this cURL post on the server? I want to access to the JSON datas (CURLOPT_POSTFILEDS content).
It isn’t in the $_POST or $_GET … any idea?
More Related Questions
- PHP – how to crawl external url using get or post method and parse json data from it? I have one server running with ZF2 and i have another client with PHP, now from client i need to read the json output via get or post method.
How to crawl external link form client and […]
- read json from web server in PHP I've problem with my application. I've made embedded web server for measuring temperature and it's getting JSON data. When I put address of my server to web browser, json data is OK. When […]
- Parser cant extract encoded string While creating a parser, using PHP Simple HTML DOM Parser, got a problem. I want to extract email address from this page. Made it with such code:
header("Content-Type: text/html; […]
- NodeJitsu PHP Curl Json API – Restart an application I have problem with use NodeJitsu API in PHP curl...
I want make php file which will be restart my application.
Here is NodeJistu API: […]
- PHP curl() Response to Associative Array I have recently started working with the PHP curl() function and I am trying to convert my retrieved JSON object to an associated array. Can anybody point me in the right direction? […]
- php – curl empty response while browser display json output $ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://itunes.apple.com/search?term=Clean%20Bandit%20-%20Rather%20Be&entity=song&limit=10&lang=fr_fr');
- Trace hierarchical tree for JSON array I just can't understand why I get undefined index for 'post' in the foreach. Here's the function I use to authenticate to the API via cURL, grab the JSON, cache it and extrapolate with the […]
- format curl results in php Below I have a piece of code to return some information through an API.
$page = 'http://api.duedil.com/sandbox/v2/company/03977902.json? fields=get_all&api_key=***********';
$ch = […]
- Send json post using php I have this data:
description: 'Boa saudaÁ„o.',
- How to send and receive data to/from an API using CURL? I have to make an API. For this, I will receive the data from the mobile devices as JSON using POST. I have to work with this data and send the response back to the devices also as […]