Data interoperability between the app side and the PHP side

Source: Internet
Author: User

Yesterday provides an interface to the app side to query the user's harvest address

This interface is referred to the original other application interface files written out, the test will always pass my verification (verify the phone-side cookie and Phpcookie comparison. )

Think of the solution, found that the cookie can not be obtained, ask the great God, and then see the app request file Discovery request interface with file_get_contents. In that case, I can't get a cookie for his app, and then change to curl request and put the app's cookie into the header message

$ch = Curl_init ();
curl_setopt ($ch, Curlopt_url, the address to be requested);
curl_setopt ($ch, Curlopt_returntransfer, 1);
curl_setopt ($ch, Curlopt_get, 1); Post,get Past
$header []= ' ACCEPT-LANGUAGE:ZH-CN ';
$header []= ' user-agent:mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1;. NET CLR 2.0.50727) ';
$header []= ' Host:my.xcar.com.cn ';
$header []= ' connection:keep-alive ';
$header []= ' cookie:php gets the name = '. $_cookie[' local name '];
curl_setopt ($ch, Curlopt_httpheader, $header); Put in the header information
$filecontent = curl_exec ($ch);

This will allow the cookie to take over so that PHP gets it.

This problem solved, but the app also said there is a mistake, I looked under, the original is my parameter filter but rigorous, immediately patched.

Summarize:

1. There is a problem with the app request.

2, my code is not rigorous.

3. The woman who wrote the app wrote it wrong.

2014-03-12

From the Baidu Space migration

Data interoperability between the app side and the PHP side

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.