Reference resources :

$curlPost = 'a=1&b=2';// simulation POST data
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-FORWARDED-FOR:', 'CLIENT-IP:'));  // structure IP
curl_setopt($ch, CURLOPT_REFERER, "");   // Structural origin  
curl_setopt($ch,CURLOPT_URL, '');// The page path that needs to be crawled
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt ($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost);//post value

$file_contents = curl_exec($ch);// The contents of the grab are put in variables

$conn=mysql_connect($mysql_server_name,$mysql_username,$mysql_password) or die("error connecting") ;


foreach($a['info'] as $row) {
$statement = "INSERT INTO `apitest` (id, status, areaid, parentid, name, remark, create_time, sort, level) VALUES ";
$statement .= ' ("' . implode($row, '","') . '")';
// echo $statement;
echo mysql_error();
// exit;


function request_post($url = '', $param = '') {
if (empty($url) || empty($param)) {
return false;

$postUrl = $url;
$curlPost = $param;
$ch = curl_init();// initialization curl
curl_setopt($ch, CURLOPT_URL,$postUrl);// Grab the specified page
curl_setopt($ch, CURLOPT_HEADER, 0);// Set up header
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);// Require the result to be a string and output to the screen
curl_setopt($ch, CURLOPT_POST, 1);//post submission
curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost);
$data = curl_exec($ch);// function curl
return $data;


Remote reading json Data and write to the database for more related articles

  1. EF+LINQ To deal with C# Use NLog Log entry operation ASP.NET MVC Multilingual Imitate the effect of Microsoft website ( turn ) Detailed explanation C# Characteristics and reflections ( One ) c# API Accept picture files to Base64 Format upload picture .NET Read json Data and bind to objects

    EF+LINQ To deal with   In the use of EF Under the circumstances , How to deal with affairs , To reduce the error of data operation , Such as repeatedly inserting data and so on , These are the problems that we often encounter But if I have multiple sites , Then there are roles of the same type to operate ...

  2. Bulk insert data , take DataTable The method of batch writing data in database

    Massive data import operations , That is to say, directly DataTable The contents of the database are written to the database Common methods : Splicing Insert sentence , Good woodlouse 1. MS Sql Server:   Use SqlBulkCopy 2. MySql ...

  3. use python Import 20 individual G Of json Data to Mysql database

    The overall idea of reference : Homework : There is one 16 individual G Related to the epidemic json News big data (articl ...

  4. DataTable The comparison of three methods of data batch writing to database

    DataTable The comparison of three methods of data batch writing to database label : it classification : C#1)   insert Circular insert :2)   sqldataadapter.update(dataset,tablename); ...

  5. iOS Lottery project -- Seventh days , First read json data 、KVC Modeling skills 、 Run time dictionary translation model and preliminary operation on the displayed web page and tracking tags

    One . First read json data Two .KVC Modeling skills , The technique here is mainly to solve the problems in the dictionary key And When some attributes in the model don't correspond Solutions for < Method 1> < Method 2> Run time dictionary to model , shipment ...

  6. Java Study -029-JSON A third -- imitation cssSelector Package read JSON Data method

    The previous article briefly introduces how to pass json-20141113.jar The function provided is to get JSON The data of , Please refer to :Java Study -028-JSON The second -- data fetch . I've learned JQuery Our friends all know , ...

  7. ajax Read json data

    First set up json.txt file { "programmers": [ { "firstName": "Brett", "lastNa ...

  8. stay MVC Dynamic read in JSON Data creation tables

    // Use getJSON // ("@Url.Action("GetAllUsers","User")" ,json Path to file . It can also be /M ...

  9. js Read json data (php The value to js)

    <?php $array =array('fds','fdsa','fdsafasd');  // json_encode($array); ?> <html> <hea ...

Random recommendation

  1. Sprint1( the second day 11.15)

    Sprint1( the second day 11.15) Sprint1 The first stage 1. Class name : Software Engineering - The first stage 2. Time :11.14-11.23 3. The content of the topic :web edition - Restaurant to store ordering system 4. Team blog address : http:// ...

  2. ( video ) 《 Create a website quickly 》3.4 Website revision 3 Minutes - WordPress Theme installation and backup

    This article is about < Create a website quickly > Series No 8 piece , If you haven't seen it before , It is recommended that you click on the chapters in the following table of contents to read other contents before returning to this article . Visit the catalog of this series , Please click on : ...

  3. QR code (QRcode) Capacity calculation and version

    4. Version information : That is, the specification of QR code ,QR Code symbols share 40 A matrix of two sizes ( It's usually black and white ), from 21x21( edition 1), To 177x177( edition 40), The symbols of each version are added to each side of the previous version 4 A module . 177 = 21+(40- ...

  4. SQL Common functions use

    1. String to integer CONVERT(INT,' character string ') 2. Result set Output as a string SELECT STUFF((SELECT ','+A FROM tableFOR XML PATH('')), ...

  5. ie8 compatible border-radius Method

    <!doctype html><html> <head>        <meta charset="utf-8" />    &l ...

  6. Oracle hextoraw and rawtohex

    Oracle hextoraw and rawtohex [ date :2012-07-17] source :Linux Community   author :adrain_001 [ typeface : Big   in   Small ]     HEXTORAW  grammar : HEXT ...

  7. 30 individual HTML Beginners suggest

    The most difficult aspect of running Nettuts+ is accounting for so many different skill levels. If w ...

  8. Volley, Small concurrent network request a good helper

    Have to say , When you don't know something , You'll think, of course , It's mysterious . But when you really come into contact with these mysterious item, There would be no such feeling . As a android I'm a novice developer , Just came into contact with Volley This open source web request box ...

  9. use SpringSecurity Build from scratch pc project -02

    Refer to this article , For example, what you don't need to do is universal , Take part of the code .

  10. 【NLP】pyhanlp flask

    D:\ProgramData\Anaconda3\Lib\site-packages\pyhanlp\ Join in WordVectorModel = LazyLoadingJClas ...