get

php curl vs python GET request

最后都变了- 提交于 2020-02-06 08:05:58
问题 I have an issue trying to convert a python GET request to php curl. This is what the python command looks like : requests.get( f'{url}/report', data={'token': reporting_token, 'format': 'pdf'} ) I'm trying to do the same thing in php curl : $ch = curl_init(); $params = array( 'token'=>'abcdefgh', 'format'=>'pdf', ) $url = $url.'?'.http_build_query($params); //this shows http://xxx/report?token=abcdefgh&format=pdf curl_setopt($ch, CURLOPT_URL, $url); $result = curl_exec($ch); This couldn't be

php curl vs python GET request

天涯浪子 提交于 2020-02-06 08:03:53
问题 I have an issue trying to convert a python GET request to php curl. This is what the python command looks like : requests.get( f'{url}/report', data={'token': reporting_token, 'format': 'pdf'} ) I'm trying to do the same thing in php curl : $ch = curl_init(); $params = array( 'token'=>'abcdefgh', 'format'=>'pdf', ) $url = $url.'?'.http_build_query($params); //this shows http://xxx/report?token=abcdefgh&format=pdf curl_setopt($ch, CURLOPT_URL, $url); $result = curl_exec($ch); This couldn't be

nginx + php-fpm - php works except cannot use $_GET

感情迁移 提交于 2020-02-05 07:02:44
问题 I'm rolling my own mvc framework starting with a front controller, which is working - all requests go through /index.php, which is loading bootstrap files eg router.php. However, $_GET isn't working, so my router.php file isn't working. My URL scheme will simply be /controller/view with .php omitted, but as yet I can't change URLs because I can't $_GET the url to pass to router.php (to load the correct controller and view). I have searched everywhere for solutions and found this similar post

Get and post method in html

大兔子大兔子 提交于 2020-02-05 06:28:06
问题 what is the meaning of these three statements: If get method is used and if the page is refreshed it would not prompt before the request is submitted again. If the response of the page is always same for the posted query then use GET example database searches If the service associated with the processing of a form has side effects (for example, modification of a database or subscription to a service), the method should be POST. The second one I understand partially: That the same result is

Access MailChimp API 3.0 (GET)

喜夏-厌秋 提交于 2020-02-04 07:29:47
问题 I'm trying to make a GET request through jQuery to the Mailchimp API. It seems though my custom header is not correctly set as I get a Your request did not include an API key. error. It works fine if I make the request using curl on my Ubuntu machine: curl --header "Authorization: apikey 709XXXXXXXXXXXXXXXXXXXXXXXXXXXXX-us11" https://us11.api.mailchimp.com/3.0/campaigns Here's my code: $.ajax({ type: 'GET', url: 'https://us11.api.mailchimp.com/3.0/campaigns', crossDomain: true, dataType:

Read binary data from a socket

。_饼干妹妹 提交于 2020-02-03 23:50:12
问题 I'm trying to connect to a server, and then send it a HTTP request (GET in this case). The idea is request a file and then receive it from the server. It should work with both text files and binary files (imgs for example). I have no problem with text files, it works perfect, but I'm having some troubles with binary files. First, I declare a BufferedReader (for reading header and textfile) and a DataInput Stream: BufferedReader in_text = new BufferedReader( new InputStreamReader(socket

Read binary data from a socket

二次信任 提交于 2020-02-03 23:46:10
问题 I'm trying to connect to a server, and then send it a HTTP request (GET in this case). The idea is request a file and then receive it from the server. It should work with both text files and binary files (imgs for example). I have no problem with text files, it works perfect, but I'm having some troubles with binary files. First, I declare a BufferedReader (for reading header and textfile) and a DataInput Stream: BufferedReader in_text = new BufferedReader( new InputStreamReader(socket

PHP - get_browser() results

假装没事ソ 提交于 2020-02-03 10:45:49
问题 I'm using the get_browser() function, and I installed the latest php_browscap.ini file from http://tempdownloads.browserscap.com/, updated my php.ini file to reflect the new location. Here's my simple code I've gleaned from PHP's site: <?php echo $_SERVER['HTTP_USER_AGENT']; echo "<br>"; echo "<br>"; $browser = get_browser(null, true); print_r($browser); ?> And the result is this: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:21.0) Gecko/20100101 Firefox/21.0 Array ( [browser_name_regex] => �

Can I POST and GET to the same PHP page

生来就可爱ヽ(ⅴ<●) 提交于 2020-02-03 04:49:07
问题 I wanted to know if it is possible to GET and POST on the same php page, for example I want to send data to: http://www.example.com/my.php So first the GET http://www.example.com/my.php?task=dosomething and POST some $thexml = XML to http://www.example.com/my.php?task=dosomething and then be able to access both in some code like (example) // Example Code ============================ if($_GET["task"] == "dosomething"){ $mynewxml = $_POST["$thexml"]; } //========================================

Get the first letter of each word in a SQL string [duplicate]

拟墨画扇 提交于 2020-02-02 03:09:21
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: sql to pick apart a string of a persons name and output the initials In MS-SQL Server , there is a way to get the first letter of each word in a string? For example: Name: Michael Joseph Jackson Query: SELECT name, [function] as initial FROM Customers Result: MJJ 回答1: This function will shield your results against multiple sequential spaces in the source string: CREATE FUNCTION dbo.fnFirsties ( @str NVARCHAR