nitiphone2021 Posted March 16, 2021 Share Posted March 16, 2021 Dear Friend, I am learning to use PHP code for using API and I found that Httpful is good. so I tried to use it but it is error. I ever use this \ but not understand what's meaning of it Quote Link to comment https://forums.phpfreaks.com/topic/312300-php-httpful-error/ Share on other sites More sharing options...
maxxd Posted March 16, 2021 Share Posted March 16, 2021 It means that either the body property of your response object doesn't exist or isn't an object. Try putting this at line 11: die('<pre>'.var_export($response, true).'</pre>'); Quote Link to comment https://forums.phpfreaks.com/topic/312300-php-httpful-error/#findComment-1585129 Share on other sites More sharing options...
nitiphone2021 Posted March 17, 2021 Author Share Posted March 17, 2021 19 hours ago, maxxd said: It means that either the body property of your response object doesn't exist or isn't an object. Try putting this at line 11: die('<pre>'.var_export($response, true).'</pre>'); This is the result: Httpful\Response::__set_state(array( 'body' => 'Not Found', 'raw_body' => 'Not Found', 'headers' => Httpful\Response\Headers::__set_state(array( 'headers' => array ( 'cache-control' => 'no-cache, no-store, max-age=0, must-revalidate', 'pragma' => 'no-cache', 'expires' => 'Mon, 01 Jan 1990 00:00:00 GMT', 'date' => 'Wed, 17 Mar 2021 07:58:44 GMT', 'vary' => 'Origin,Accept-Encoding', 'content-type' => 'text/html; charset=UTF-8', 'x-content-type-options' => 'nosniff', 'x-frame-options' => 'SAMEORIGIN', 'content-security-policy' => 'frame-ancestors \'self\'', 'x-xss-protection' => '1; mode=block', 'server' => 'GSE', 'alt-svc' => 'h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"', 'accept-ranges' => 'none', ), )), 'raw_headers' => 'HTTP/2 404 cache-control: no-cache, no-store, max-age=0, must-revalidate pragma: no-cache expires: Mon, 01 Jan 1990 00:00:00 GMT date: Wed, 17 Mar 2021 07:58:44 GMT vary: X-Origin vary: Origin,Accept-Encoding content-type: text/html; charset=UTF-8 x-content-type-options: nosniff x-frame-options: SAMEORIGIN content-security-policy: frame-ancestors \'self\' x-xss-protection: 1; mode=block server: GSE alt-svc: h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43" accept-ranges: none', 'request' => Httpful\Request::__set_state(array( 'uri' => 'https://www.googleapis.com/freebase/v1/mqlread?query=%7B%22type%22:%22/music/artist%22%2C%22name%22:%22The%20Dead%20Weather%22%2C%22album%22:%5B%5D%7D', 'method' => 'GET', 'headers' => array ( 'Content-Length' => 0, ), 'raw_headers' => 'GET /freebase/v1/mqlread?query=%7B%22type%22:%22/music/artist%22%2C%22name%22:%22The%20Dead%20Weather%22%2C%22album%22:%5B%5D%7D HTTP/1.1 Host: www.googleapis.com Expect: User-Agent: Httpful/0.2.19 (cURL/7.70.0 PHP/7.4.9 (WINNT) Apache/2.4.46 (Win64) OpenSSL/1.1.1g .4.9 Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36) Content-Type: Accept: */*; q=0.5, text/plain; q=0.8, text/html;level=3; Content-Length: 0 ', 'strict_ssl' => false, 'content_type' => NULL, 'expected_type' => NULL, 'additional_curl_opts' => array ( ), 'auto_parse' => true, 'serialize_payload_method' => 2, 'username' => NULL, 'password' => NULL, 'serialized_payload' => NULL, 'payload' => NULL, 'parse_callback' => NULL, 'error_callback' => NULL, 'send_callback' => NULL, 'follow_redirects' => false, 'max_redirects' => 25, 'payload_serializers' => array ( ), '_ch' => NULL, '_debug' => NULL, )), 'code' => 404, 'content_type' => 'text/html', 'parent_type' => 'text/html', 'charset' => 'UTF-8', 'meta_data' => array ( 'url' => 'https://www.googleapis.com/freebase/v1/mqlread?query=%7B%22type%22:%22/music/artist%22%2C%22name%22:%22The%20Dead%20Weather%22%2C%22album%22:%5B%5D%7D', 'content_type' => 'text/html; charset=UTF-8', 'http_code' => 404, 'header_size' => 615, 'request_size' => 460, 'filetime' => -1, 'ssl_verify_result' => 0, 'redirect_count' => 0, 'total_time' => 0.22407, 'namelookup_time' => 0.024054, 'connect_time' => 0.070344, 'pretransfer_time' => 0.160193, 'size_upload' => 0.0, 'size_download' => 9.0, 'speed_download' => 40.0, 'speed_upload' => 0.0, 'download_content_length' => -1.0, 'upload_content_length' => -1.0, 'starttransfer_time' => 0.223987, 'redirect_time' => 0.0, 'redirect_url' => '', 'primary_ip' => '216.58.199.10', 'certinfo' => array ( ), 'primary_port' => 443, 'local_ip' => '192.168.1.118', 'local_port' => 59839, 'http_version' => 3, 'protocol' => 2, 'ssl_verifyresult' => 0, 'scheme' => 'HTTPS', 'appconnect_time_us' => 159930, 'connect_time_us' => 70344, 'namelookup_time_us' => 24054, 'pretransfer_time_us' => 160193, 'redirect_time_us' => 0, 'starttransfer_time_us' => 223987, 'total_time_us' => 224070, ), 'is_mime_vendor_specific' => false, 'is_mime_personal' => false, 'parsers' => NULL, )) Quote Link to comment https://forums.phpfreaks.com/topic/312300-php-httpful-error/#findComment-1585147 Share on other sites More sharing options...
Barand Posted March 17, 2021 Share Posted March 17, 2021 Perhaps this is why Quote Link to comment https://forums.phpfreaks.com/topic/312300-php-httpful-error/#findComment-1585149 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.