Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {"carrier":"R&L Carriers","charge":"99.13","service_days":"Wednesday Oct. 22, 2014"}
- <?php
- //include ('mysql_connect.php');
- $result = mysql_query('select * from quote where user_id = "'.$user_id.'" order by netCharge asc limit 1');
- if (!$result) {
- die('Could not query:' . mysql_error());
- }
- if (!$result) echo mysql_error();
- $api_data = array();
- $api_count = '0';
- while ($row = mysql_fetch_array($result, MYSQLI_ASSOC)) {
- $api_data[carrier] = $row['carrier'];
- $api_data[charge] = $row['netCharge'];
- $api_data[service_days] = $row['serviceDays'];
- $api_count++;
- }
- $api_data = json_encode($api_data);
- print_r($api_data);
- ?>
- <?php
- $input = file_get_contents('api_request.php?dest_zip=66101&weight=200&class=50<l_shipment=X&Residential_Delivery=X');
- echo $input;
- $obj = json_decode($input);
- var_dump($obj);
- ?>
- $array = json_decode($data, true);
- {"carrier":"R&L Carriers","charge":"99.13","service_days":"Wednesday Oct. 22, 2014"}
- <?php
- $input = file_get_contents('example.json');
- echo $input;
- // {"carrier":"R&L Carriers","charge":"99.13","service_days":"Wednesday Oct. 22, 2014"}
- $obj = json_decode($input);
- var_dump($obj);
- // object(stdClass)#1 (3) {
- // ["carrier"]=>
- // string(12) "R&L Carriers"
- // ["charge"]=>
- // string(5) "99.13"
- // ["service_days"]=>
- // string(23) "Wednesday Oct. 22, 2014"
- // }
- $str = trim($str," ") ;
- $str = trim($str,"n") ;
- $str = stripslashes($str);
Add Comment
Please, Sign In to add comment