Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Wyrażenia regularne
lDoran
post
Post #1





Grupa: Zarejestrowani
Postów: 172
Pomógł: 13
Dołączył: 15.11.2009

Ostrzeżenie: (0%)
-----


Chciałbym wyciągnąć wartość value z tego ciągu:
Kod
input type="hidden" id="referredby" name="referredby" value="http://devldoran.wordpress.com/wp-admin/post-new.php"

mój kod:
  1. ...
  2. preg_match('/input type="hidden" id="referredby" name="referredby" value="(.*?)"/', $input, $output);
  3. $this->_aTokens['referredby'] = $output[1];
  4. ...

niestety indeks tablicy $output[1] jest pusty
Kod
array(2) { [0]=>  string(62) "input type="hidden" id="referredby" name="referredby" value=""" [1]=>  string(0) "" }

WTF?! (IMG:style_emoticons/default/sciana.gif)
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
lDoran
post
Post #2





Grupa: Zarejestrowani
Postów: 172
Pomógł: 13
Dołączył: 15.11.2009

Ostrzeżenie: (0%)
-----


Kiedy na localhoscie pobieram stronę odpowiedzialną za dodanie postu w cms'ie wp wartość value jest pełna, przy wyciąganiu wartości preg_match $output[1] jest pusty nie rozumiem dlaczego tak się dzieje

EDIT:
  1. private function writeNewPost() {
  2. curl_setopt($this->_hCurl, CURLOPT_URL, $this->_sWebSite . 'wp-admin/post-new.php');
  3. $input = curl_exec($this->_hCurl);
  4. var_dump($input);
  5. $this->getTokens($input);
  6. curl_setopt($this->_hCurl, CURLOPT_POST, 1);
  7. curl_setopt($this->_hCurl, CURLOPT_POSTFIELDS,
  8. '_wpnonce=' . $this->_aTokens['_wpnonce'] .
  9. '&_wp_http_referer=' . $this->_aTokens['_wp_http_referer'] .
  10. '&user_ID=' . $this->_aTokens['user_ID'] .
  11. '&action=' . $this->_aTokens['hiddenaction'] .
  12. '&originalaction=' . $this->_aTokens['originalaction'] .
  13. '&post_author=' . $this->_aTokens['post_author'] .
  14. '&post_type=' . $this->_aTokens['post_type'] .
  15. '&original_post_status=' . $this->_aTokens['original_post_status'] . '
  16. &referredby=' . $this->_aTokens['referredby'] . '
  17. &_wp_original_http_referer=' . $this->_aTokens['_wp_original_http_referer'] .
  18. '&auto_draft=' . $this->_aTokens['auto_draft'] . '
  19. &post_ID=' . $this->_aTokens['post_ID'] .
  20. '&autosavenonce=' . $this->_aTokens['autosavenonce'] .
  21. '&meta-box-order-nonce=' . $this->_aTokens['meta-box-order-nonce'] .
  22. '&closedpostboxesnonce=' . $this->_aTokens['closedpostboxesnonce'] .
  23. '&wp-preview=
  24. &hidden_post_status=' . $this->_aTokens['hidden_post_status'] .
  25. '&post_status=draft
  26. &hidden_post_password=' . $this->_aTokens['hidden-post-password'] .
  27. '&hidden_post_visibility=' . $this->_aTokens['hidden-post-visibility'] . '
  28. &visibility=public
  29. &post_password=
  30. &jj=' . $this->_aTokens['jj'] .
  31. '&mm=' . $this->_aTokens['mm'] .
  32. '&aa=' . $this->_aTokens['aa'] .
  33. '&hh=' . $this->_aTokens['hh'] .
  34. '&mn=' . $this->_aTokens['mn'] .
  35. '&ss=' . $this->_aTokens['ss'] .
  36. '&hidden_mm=' . $this->_aTokens['hidden_mm'] .
  37. '&cur_mm=' . $this->_aTokens['cur_mm'] .
  38. '&hidden_jj=' . $this->_aTokens['hidden_jj'] .
  39. '&cur_jj=' . $this->_aTokens['cur_jj'] .
  40. '&hidden_aa=' . $this->_aTokens['hidden_aa'] .
  41. '&cur_aa=' . $this->_aTokens['cur_aa'] .
  42. '&hidden_hh=' . $this->_aTokens['hidden_hh'] .
  43. '&cur_hh=' . $this->_aTokens['cur_hh'] .
  44. '&hidden_mn=' . $this->_aTokens['hidden_mn'] .
  45. '&cur_mn=' . $this->_aTokens['cur_mn'] .
  46. '&original_publish=Opublikuj
  47. &publish=Opublikuj
  48. &post_category%5B%5D=0
  49. &newcategory=New+Category+Name
  50. &newcategory_parent=-1
  51. &_ajax_nonce-add-category=' . $this->_aTokens['_ajax_nonce-add-category'] . '
  52. &tax_input%5Bpost_tag%5D=
  53. &newtag%5Bpost_tag%5D=
  54. &post_title=' . $this->_sTitle .
  55. '&samplepermalinknonce=' . $this->_aTokens['samplepermalinknonce'] .
  56. '&content=' . $this->_sContent .
  57. '&excerpt=
  58. &trackback_url=
  59. &advanced_view=1
  60. &comment_status=open
  61. &ping_status=open
  62. &post_name=
  63. &wpl_enable_post_likes=1
  64. &wpl_like_status_hidden=1
  65. &wpl_enable_post_sharing=1
  66. &wpl_sharing_status_hidden=1');
  67. curl_setopt($this->_hCurl, CURLOPT_FOLLOWLOCATION, 1);
  68. curl_exec($this->_hCurl);

wynik var_dump
Kod
string(76213) "


Ten post edytował lDoran 20.10.2010, 11:57:34
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 11.10.2025 - 15:06