Posts

Showing posts from September, 2018

URL

https://github.com/aisuhua

Getting jSON Data with PHP (curl method)

For a customer project, we needed to do a  jSON  query with PHP. So I  searched the web for a tutorial how to do, but I’ve found much about the PHP jSON functions, but not much how to make requests to jSON interfaces with PHP. So I try to explain you how it works. Sending Data with PHP to a  jSON Script with curl To get the data we use the  PHP curl  functions. In our example we have added a authentication with curl, if not needed, just leave the lines, commented with  // authentication . [php] // jSON URL which should be requested $json_url = ‘http://www.mydomain.com/json_script.json’; $username = ‘your_username’;  // authentication $password = ‘your_password’;  // authentication // jSON String for request $json_string = ‘[your json string here]’; // Initializing curl $ch = curl_init( $json_url ); // Configuring curl options $options = array( CURLOPT_RETURNTRANSFER => true, CURLOPT_USERPWD => $username . “:” . $pas...

PHP API

PHP 5 Tutorial PHP 5 Introduction PHP 5 Installation PHP 5 Syntax PHP 5 Variables PHP 5 Echo And Print Statements PHP 5 Data Types PHP – AJAX and MySQL AJAX Introduction PHP AJAX Live Search PHP – AJAX and PHP PHP AJAX Poll PHP AJAX RSS Reader PHP Example – AJAX and XML PHP 5 Arrays PHP 5 Multidimensional Arrays PHP 5 Sorting Arrays PHP 5 Constants PHP 5 Cookies PHP 5 Date And Time PHP Error Handling PHP Exception Handling PHP 5 File Handling PHP 5 File Create/Write PHP 5 File Open/Read/Close PHP 5 File Upload PHP Filters PHP Filters Advanced PHP 5 Complete Form Example PHP 5 Forms Required Fields PHP 5 Forms – Validate E-mail and URL PHP 5 Form Validation PHP 5 Form Handling PHP 5 Functions PHP 5 If, Else And Elseif Statements PHP 5 Include Files PHP 5 While Loops PHP 5 For Loops PHP Connect To MySQL PHP Create a MySQL Database ...